/* ===== CSS VARIABLES - Light Theme ===== */
:root {
  /* Background - White theme */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f1f3f4;
  --bg-card: #ffffff;
  --bg-hover: #e8eaed;

  --text-primary: #1a1a1a;
  --text-secondary: #5f6368;
  --text-muted: #9aa0a6;

  /* Accent colors */
  --accent-red: #ea4335;
  --accent-orange: #fbbc04;
  --accent-yellow: #f9ab00;
  --accent-green: #34a853;
  --accent-blue: #4285f4;
  --accent-purple: #9334e6;
  --accent-cyan: #00bcd4;

  --border-color: rgba(0, 0, 0, 0.1);
  --border-hover: rgba(0, 0, 0, 0.2);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 40px rgba(234, 67, 53, 0.15);
  --shadow-glow-orange: 0 0 40px rgba(251, 188, 4, 0.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;

  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ===== UTILITY CLASSES ===== */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ===== FOCUS STYLES ===== */
*:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* ===== HEADER / NAV ===== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.site-header.scrolled {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.logo-icon {
  font-size: 28px;
  filter: drop-shadow(0 0 10px rgba(255, 71, 87, 0.4));
}

.logo-text {
  background: linear-gradient(135deg, var(--accent-red), var(--accent-orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: center;
}

.nav-link {
  padding: 8px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
  white-space: nowrap;
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-red), var(--accent-orange));
  opacity: 0;
  transition: width var(--transition-normal), opacity var(--transition-normal);
  transform: translateX(-50%);
  border-radius: 2px;
}

.nav-link:hover, .nav-link.active {
  color: var(--accent-red);
  background: rgba(234, 67, 53, 0.08);
  border-color: rgba(234, 67, 53, 0.15);
  transform: translateY(-1px);
}

.nav-link:hover::after, .nav-link.active::after {
  width: 60%;
  opacity: 1;
}

.nav-link:focus-visible {
  color: var(--text-primary);
  background: rgba(255, 71, 87, 0.12);
  border-color: rgba(255, 71, 87, 0.25);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.mobile-menu-btn {
  display: none;
  background: rgba(255, 71, 87, 0.08);
  border: 1px solid rgba(255, 71, 87, 0.2);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 8px 10px;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.mobile-menu-btn:hover {
  background: rgba(255, 71, 87, 0.14);
  border-color: rgba(255, 71, 87, 0.35);
}

.mobile-menu-btn:active {
  transform: scale(0.97);
}

/* Mobile Menu */
.mobile-menu {
  display: flex;
  position: absolute;
  top: 64px;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 16px;
  flex-direction: column;
  gap: 4px;
  z-index: 999;
  opacity: 0;
  transform: translateY(-8px);
  visibility: hidden;
  pointer-events: none;
  max-height: 0;
  overflow: hidden;
  transition: opacity var(--transition-fast), transform var(--transition-fast), max-height var(--transition-fast), visibility var(--transition-fast);
}

.mobile-menu.active {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
  pointer-events: auto;
  max-height: 320px;
}

.mobile-nav-link {
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.mobile-nav-link:hover {
  color: var(--accent-red);
  background: rgba(234, 67, 53, 0.08);
  border-color: rgba(234, 67, 53, 0.15);
}

.mobile-nav-link:focus-visible {
  color: var(--accent-red);
  background: rgba(234, 67, 53, 0.1);
  border-color: rgba(255, 71, 87, 0.25);
}

/* ===== BUTTONS - Hermes Style ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-red), var(--accent-orange));
  color: white;
  box-shadow: 0 4px 20px rgba(255, 71, 87, 0.35), inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn-primary:hover {
  box-shadow: 0 8px 30px rgba(255, 71, 87, 0.5), inset 0 1px 0 rgba(255,255,255,0.3);
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

/* ===== BADGES ===== */
.badge {
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-hot {
  background: rgba(248, 113, 113, 0.2);
  color: var(--accent-red);
}

.badge-new {
  background: rgba(74, 222, 128, 0.2);
  color: var(--accent-green);
}

.badge-free {
  background: rgba(250, 204, 21, 0.2);
  color: var(--accent-yellow);
}

.badge-featured {
  background: rgba(192, 132, 252, 0.2);
  color: var(--accent-purple);
}

.badge-open {
  background: rgba(34, 211, 238, 0.2);
  color: var(--accent-cyan);
}

/* ===== FOOTER ===== */
/* ===== FOOTER (Unified) ===== */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 60px 0 30px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
}

.footer-brand {
  max-width: 300px;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.footer-logo-icon {
  font-size: 28px;
}

.footer-desc {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 20px;
}

.footer-social {
  display: flex;
  gap: 12px;
}

.social-link {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 18px;
  transition: all var(--transition-fast);
  border: 1px solid var(--border-color);
}

.social-link:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--bg-hover);
}

.footer-column h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.footer-column ul {
  list-style: none;
}

.footer-column li {
  margin-bottom: 10px;
}

.footer-column a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: color var(--transition-fast);
}

.footer-column a:hover {
  color: var(--text-primary);
}

.footer-bottom {
  padding-top: 30px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-copyright {
  color: var(--text-muted);
  font-size: 13px;
}

.footer-meta {
  display: flex;
  gap: 24px;
  color: var(--text-muted);
  font-size: 13px;
}

@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  
  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}

/* ===== LOADING & EMPTY STATES ===== */
.loading-state {
  text-align: center;
  padding: 100px 20px;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--bg-tertiary);
  border-top-color: var(--accent-red);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error-state {
  text-align: center;
  padding: 100px 20px;
}

.error-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.error-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.error-text {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-desc {
  font-size: 14px;
}

/* ===== PREFERS REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .loading-spinner {
    animation: none;
    border-top-color: var(--bg-tertiary);
    opacity: 0.5;
  }
}

/* ===== NEWS SECTION ===== */
.news-section {
  padding: 60px 0;
  background: var(--bg-primary);
}

.news-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto auto;
  gap: 16px;
}

.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease;
  display: flex;
  flex-direction: column;
}

.news-card:hover {
  border-color: var(--text-secondary);
}

.news-featured {
  grid-row: 1 / 3;
  padding: 24px;
}

.news-tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  width: fit-content;
}

.news-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.news-featured .news-title {
  font-size: 20px;
}

.news-excerpt {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
  flex: 1;
}

.news-date {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== MATRIX SECTION ===== */
.matrix-section {
  padding: 60px 0;
}

.matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.matrix-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-normal);
}

.matrix-card:hover {
  border-color: var(--accent-orange);
  box-shadow: var(--shadow-md);
}

.matrix-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.matrix-label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.matrix-best {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-orange);
  margin-bottom: 4px;
}

.matrix-alt {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== TUTORIALS HOME SECTION ===== */
.tutorials-home-section {
  padding: 60px 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

.tutorials-home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 16px;
}

.tutorials-home-grid .news-featured {
  grid-row: 1 / 3;
  padding: 24px;
}

@media (max-width: 1024px) {
  .tutorials-home-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .tutorials-home-grid .news-featured {
    grid-row: auto;
  }
}

@media (max-width: 768px) {
  .tutorials-home-grid {
    grid-template-columns: 1fr 1fr;
  }
  .tutorials-home-grid .news-featured {
    grid-column: 1 / -1;
  }
}

@media (max-width: 480px) {
  .tutorials-home-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .container {
    max-width: 100%;
  }
  
  .news-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .news-featured {
    grid-row: auto;
  }
}

@media (max-width: 768px) {
  .main-nav {
    display: none;
  }

  .mobile-menu-btn {
    display: block;
  }

  .container {
    padding: 0 16px;
  }
  
  .news-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .news-featured {
    grid-column: 1 / -1;
  }
  
  .matrix-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .btn {
    width: 100%;
  }
  
  .news-grid {
    grid-template-columns: 1fr;
  }
  
  .matrix-grid {
    grid-template-columns: 1fr;
  }
}
