/* ============================================
   COMMON STYLES - styles.css
   ============================================ */

/* CSS Variables for Theme */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --text-primary: #1a1a1a;
  --text-secondary: #2a2a2a;
  --text-tertiary: #4a4a4a;
  --text-muted: #6a6a6a;
  --border-color: #e5e5e5;
  --link-color: #1a1a1a;
}

[data-theme="dark"] {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2a2a2a;
  --text-primary: #ffffff;
  --text-secondary: #e5e5e5;
  --text-tertiary: #cccccc;
  --text-muted: #999999;
  --border-color: #333333;
  --link-color: #ffffff;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Header Styles */
header {
  position: sticky;
  top: 0;
  background-color: var(--bg-primary);
  /* border-bottom: 1px solid var(--border-color); */
  z-index: 1000;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: color 0.3s ease;
}

/* Navigation */
.nav-wrapper {
  display: flex;
  align-items: center;
  gap: 2rem;
}

nav ul {
  display: flex;
  gap: 2rem;
  list-style: none;
}

nav a {
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s ease;
  font-weight: 400;
}

nav a:hover {
  color: var(--text-primary);
}

/* Theme Toggle Button */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  transition: opacity 0.2s ease;
}

.theme-toggle:hover {
  opacity: 0.6;
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.theme-icon {
  display: none;
}

[data-theme="light"] .theme-icon.sun,
[data-theme="dark"] .theme-icon.moon {
  display: block;
}

/* Hamburger Menu */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 0.5rem;
}

.hamburger span {
  width: 24px;
  height: 2px;
  background-color: var(--text-primary);
  transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(7px, 7px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Menu */
.mobile-menu {
  display: none;
  position: fixed;
  top: 73px;
  left: 0;
  right: 0;
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 2rem;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.mobile-menu.active {
  display: block;
}

.mobile-menu ul {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  list-style: none;
}

.mobile-menu a {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 1.1rem;
  transition: color 0.3s ease;
}

/* Mobile Controls */
.mobile-controls {
  display: none;
  align-items: center;
  gap: 1rem;
}

/* Main Container */
main {
  max-width: 800px;
  margin: 0 auto;
  padding: 4rem 2rem;
}

/* Page Title */
.page-title {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 3rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  transition: color 0.3s ease;
}

/* Article Cards (for list pages) */
.pinned-articles,
.articles-list {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.article-card {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 3rem;
  transition: border-color 0.3s ease;
}

.article-card:last-child {
  border-bottom: none;
}

.article-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  transition: color 0.3s ease;
}

.article-card .article-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.article-card .article-title a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.article-card .article-title a:hover {
  color: var(--text-tertiary);
}

.article-excerpt {
  font-size: 1rem;
  color: var(--text-tertiary);
  line-height: 1.7;
  margin-bottom: 1rem;
  transition: color 0.3s ease;
}

.read-more {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-bottom: 1px solid var(--text-primary);
  transition: opacity 0.2s ease, color 0.3s ease, border-color 0.3s ease;
}

.read-more:hover {
  opacity: 0.6;
}

.pin-badge {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--text-primary);
  border: 1px solid var(--text-primary);
  padding: 0.25rem 0.5rem;
  margin-bottom: 0.75rem;
  font-weight: 500;
  transition: color 0.3s ease, border-color 0.3s ease;
}

/* Individual Article Page Styles */
.article-page main {
  max-width: 680px;
}

.article-header {
  margin-bottom: 3rem;
}

.article-header .article-title {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  transition: color 0.3s ease;
}

.article-header .article-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.9rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.article-header .article-meta span {
  display: flex;
  align-items: center;
}

/* Article Content Typography */
.article-content {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--text-secondary);
  transition: color 0.3s ease;
}

.article-content p {
  margin-bottom: 1.75rem;
}

.article-content h2 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-top: 3rem;
  margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  transition: color 0.3s ease;
}

.article-content h3 {
  font-size: 1.375rem;
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  transition: color 0.3s ease;
}

.article-content blockquote {
  border-left: 3px solid var(--text-primary);
  padding-left: 1.5rem;
  margin: 2.5rem 0;
  font-style: italic;
  color: var(--text-tertiary);
  transition: border-color 0.3s ease, color 0.3s ease;
}

.article-content img {
  width: 100%;
  height: auto;
  margin: 3rem 0;
  display: block;
}

.article-content ul,
.article-content ol {
  margin-bottom: 1.75rem;
  padding-left: 1.5rem;
}

.article-content li {
  margin-bottom: 0.75rem;
}

.article-content a {
  color: var(--link-color);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: opacity 0.2s ease, color 0.3s ease;
}

.article-content a:hover {
  opacity: 0.6;
}

.article-content code {
  background-color: var(--bg-secondary);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-size: 0.95em;
  font-family: 'Monaco', 'Courier New', monospace;
  transition: background-color 0.3s ease;
}

.image-caption {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: -2rem;
  margin-bottom: 3rem;
  font-style: italic;
  transition: color 0.3s ease;
}

/* Archive Layout */
.archive-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 2rem;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 4rem;
  align-items: start;
}

/* Sidebar */
.archive-sidebar {
  position: sticky;
  top: 100px;
}

.sidebar-title {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  transition: color 0.3s ease;
}

.sidebar-description {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
  transition: color 0.3s ease;
}

.sidebar-description a {
  color: var(--link-color);
  text-decoration: unset;
}

/* Articles Content */
.archive-content {
  max-width: 700px;
}

/* Year Section */
.year-section {
  margin-bottom: 4rem;
}

.year-badge {
  /* position: sticky; */
  /* top: 80px; */
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.5rem 1.25rem;
  border-radius: 24px;
  display: inline-block;
  margin-bottom: 2rem;
  /* z-index: 10; */
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Month Section */
.month-section {
  margin-bottom: 3rem;
}

.month-title {
  /* position: sticky; */
  /* top: 130px; */
  background-color: var(--bg-primary);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  padding: 0.5rem 0;
  /* z-index: 9; */
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Article Item */
.article-item {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  transition: border-color 0.3s ease;
}

.article-item:last-child {
  border-bottom: none;
}

.article-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  transition: color 0.3s ease;
}

.article-link {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
  display: inline-block;
}

.article-link:hover {
  color: var(--text-tertiary);
}

/* Hero Section with Slogan */
.hero-section {
  max-width: 800px;
  margin: 0 auto;
  padding: 5rem 2rem 3rem;
  text-align: center;
}

.hero-slogan {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  transition: color 0.3s ease;
}

.hero-description {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--text-tertiary);
  max-width: 600px;
  margin: 0 auto 3rem;
  transition: color 0.3s ease;
}

/* Footer */
footer {
  border-top: 1px solid var(--border-color);
  padding: 3rem 2rem;
  margin-top: 6rem;
  transition: border-color 0.3s ease;
}

.footer-container {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.footer-donation a {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--text-primary);
  transition: opacity 0.2s ease, color 0.3s ease, border-color 0.3s ease;
}

.footer-donation a:hover {
  opacity: 0.6;
}

.footer-copyright {
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: color 0.3s ease;
}

/* Responsive */
@media (max-width: 968px) {
  .archive-container {
      grid-template-columns: 1fr;
      gap: 2rem;
  }

  .archive-sidebar {
      position: static;
  }

  .sidebar-title {
      font-size: 1.5rem;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .header-container {
      padding: 1.25rem 1.5rem;
  }

  .nav-wrapper {
      display: none;
  }

  .mobile-controls {
      display: flex;
  }

  .hamburger {
      display: flex;
  }

  main {
      padding: 3rem 1.5rem;
  }

  .page-title {
      font-size: 1.75rem;
  }

  .article-card .article-title {
      font-size: 1.3rem;
  }

  .article-header .article-title {
      font-size: 2rem;
  }

  .article-content {
      font-size: 1.0625rem;
  }

  .article-content h2 {
      font-size: 1.5rem;
      margin-top: 2.5rem;
  }

  .article-content h3 {
      font-size: 1.25rem;
      margin-top: 2rem;
  }

  .archive-container {
    padding: 3rem 1.5rem;
  }

  /* .year-badge {
      top: 74px;
  } */

  .month-title {
      /* top: 124px; */
      font-size: 1.25rem;
  }

  .article-link {
      font-size: 1rem;
  }

  .hero-section {
    padding: 4rem 1.5rem 2rem;
  }

  .hero-slogan {
      font-size: 2rem;
  }

  .hero-description {
      font-size: 1rem;
  }

  .footer-container {
      flex-direction: column;
      text-align: center;
      gap: 1rem;
  }
}

@media (max-width: 480px) {
  .article-header .article-title {
      font-size: 1.75rem;
  }

  .article-header .article-meta {
      flex-direction: column;
      gap: 0.5rem;
  }

  .hero-slogan {
    font-size: 1.75rem;
  }
}