:root {
  --sidebar-width: 290px;
  --sidebar-bg: #d946ef;
  --main-bg: #ffffff;
  --main-text: #1a1a1a;
  --main-text-secondary: #666666;
  --card-bg: #f5f5f5;
  --card-bg-hover: #ebebeb;
  --border-color: #e0e0e0;
  --accent-primary: #d946ef;
}

[data-theme="dark"] {
  --main-bg: #1a1f2e;
  --main-text: #e5e7eb;
  --main-text-secondary: #9ca3af;
  --card-bg: #252b3b;
  --card-bg-hover: #2d3548;
  --border-color: #374151;
}

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

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
  color: var(--main-text);
  background-color: var(--main-bg);
  transition: background-color 0.3s, color 0.3s;
}

#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  height: 100dvh;
  background: linear-gradient(180deg, #d946ef 0%, #a855f7 50%, #d946ef 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 2rem 1.5rem;
  box-shadow: 4px 0 12px rgba(168, 85, 247, 0.3);
}

.profile {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-shrink: 0;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  margin: 0;
}

.profile-info {
  flex: 1;
  min-width: 0;
}

.profile-name-link {
  text-decoration: none;
  transition: opacity 0.2s;
}

.profile-name-link:hover {
  opacity: 0.8;
}

.profile-name {
  color: white;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  line-height: 1.2;
}

.profile-title {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.2;
}

nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

nav a {
  color: white;
  text-decoration: none;
  padding: 0.875rem 1rem;
  border-radius: 0.75rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background-color: rgba(255, 255, 255, 0.1);
}

nav a:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: translateX(2px);
}

nav a.active {
  background-color: rgba(255, 255, 255, 0.25);
}

nav a svg {
  flex-shrink: 0;
}

.dark-mode-toggle {
  flex-shrink: 0;
  padding: 0.5rem;
  background-color: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s;
  margin-bottom: 1rem;
  align-self: flex-start;
}

.dark-mode-toggle:hover {
  color: white;
}

.dark-mode-toggle .moon-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.dark-mode-toggle span {
  display: none;
}

.toggle-switch {
  width: 36px;
  height: 18px;
  background-color: rgba(255, 255, 255, 0.25);
  border-radius: 9px;
  position: relative;
  transition: background-color 0.3s;
}

[data-theme="dark"] .toggle-switch {
  background-color: rgba(255, 255, 255, 0.4);
}

.toggle-slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s;
}

[data-theme="dark"] .toggle-slider {
  transform: translateX(18px);
}

.sidebar-bg {
  width: 100%;
  display: block;
  flex-shrink: 0;
}

.main-content {
  margin-left: var(--sidebar-width);
  padding: 3rem;
  min-height: 100vh;
}

.home-page {
  max-width: 1200px;
}

.article-card {
  background-color: var(--card-bg);
  border-radius: 1rem;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
  border: 1px solid var(--border-color);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.article-card:hover {
  background-color: var(--card-bg-hover);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.article-card-header {
  width: 100%;
  height: 200px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.article-card-title-bg {
  font-size: 3.5rem;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.15);
  filter: blur(2px);
  text-align: center;
  padding: 2rem;
  line-height: 1.2;
  word-break: break-word;
  animation: drift 75s ease-in-out infinite;
}

@keyframes drift {
  0% {
    transform: translate(-10px, -5px) rotate(-1deg);
  }
  25% {
    transform: translate(8px, 5px) rotate(0.5deg);
  }
  50% {
    transform: translate(12px, -3px) rotate(1deg);
  }
  75% {
    transform: translate(-5px, 8px) rotate(-0.5deg);
  }
  100% {
    transform: translate(-10px, -5px) rotate(-1deg);
  }
}

.category-1 {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.category-2 {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.category-3 {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.category-4 {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.article-card-content {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.article-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.category-tag {
  display: inline-block;
  background-color: rgba(217, 70, 239, 0.1);
  color: var(--accent-primary);
  padding: 0.375rem 0.875rem;
  border-radius: 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s;
}

.category-tag:hover {
  background-color: rgba(217, 70, 239, 0.2);
}

.article-date {
  color: var(--main-text-secondary);
  font-size: 0.875rem;
}

.article-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.article-title a {
  color: var(--main-text);
  text-decoration: none;
}

.article-title a:hover {
  color: var(--accent-primary);
}

.article-excerpt {
  color: var(--main-text-secondary);
  line-height: 1.6;
  margin-bottom: 1.25rem;
  flex: 1;
}

.read-more {
  color: var(--accent-primary);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: gap 0.2s;
}

.read-more:hover {
  gap: 0.75rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}

.category-page {
  max-width: 1200px;
}

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

.category-description {
  font-size: 1.125rem;
  color: var(--main-text-secondary);
}

.category-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.sort-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--main-text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.sort-toggle:hover {
  background-color: var(--card-bg-hover);
  color: var(--main-text);
}

.sort-toggle .sort-icon {
  transition: transform 0.2s;
}

.sort-toggle.desc .sort-icon {
  transform: scaleY(-1);
}

.article-wrapper {
  display: contents;
}

.article-top {
  text-align: right;
  margin-bottom: 1rem;
}

.article-category-tag {
  display: inline-block;
  background-color: rgba(217, 70, 239, 0.1);
  color: var(--accent-primary);
  padding: 0.375rem 0.875rem;
  border-radius: 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s;
}

.article-category-tag:hover {
  background-color: rgba(217, 70, 239, 0.2);
}

.article-page {
  max-width: 800px;
  margin: 0 auto;
}

.article-hero {
  max-width: 512px;
  height: 280px;
  margin: 0 auto 2rem;
  border-radius: 1rem;
  overflow: hidden;
}

.article-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-meta {
  color: var(--main-text-secondary);
}

.article-content {
  font-size: 1.125rem;
  line-height: 1.75;
  margin-top: 2rem;
}

.article-top-nav {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  gap: 1rem;
}

.article-top-nav-link {
  color: var(--accent-primary);
  text-decoration: none;
  max-width: 45%;
  display: inline;
  padding: 0;
  border-radius: 0;
  background-color: transparent;
}

.article-top-nav-link:hover {
  text-decoration: underline;
  background-color: transparent;
  transform: none;
}

.article-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.article-footer .btn {
  max-width: 45%;
}

.article-comments {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.article-comments h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--main-text);
}

.giscus {
  margin-top: 1rem;
}

footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--main-text-secondary);
  font-size: 0.875rem;
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 600;
  transition: opacity 0.2s;
}

.btn-secondary {
  background-color: transparent;
  color: var(--accent-primary);
  border: 2px solid var(--accent-primary);
}

.btn-secondary:hover {
  background-color: var(--accent-primary);
  color: white;
  opacity: 1;
}

#menu-toggle {
  display: none;
  position: fixed;
  top: 1.5rem;
  left: 1.5rem;
  z-index: 1001;
  background-color: var(--sidebar-bg);
  border: none;
  padding: 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  flex-direction: column;
  gap: 0.35rem;
  width: 3rem;
  height: 3rem;
  justify-content: center;
  align-items: center;
}

#menu-toggle span {
  display: block;
  width: 1.5rem;
  height: 2px;
  background-color: white;
  transition: all 0.3s;
  border-radius: 2px;
}

#menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(0.4rem, 0.4rem);
}

#menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

#menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(0.4rem, -0.4rem);
}

@media (max-width: 768px) {
  #menu-toggle {
    display: flex;
  }

  #sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
    z-index: 1000;
  }

  #sidebar.active {
    transform: translateX(0);
  }

  .profile {
    margin-top: 2.5rem;
  }

  .main-content {
    margin-left: 0;
    padding: 5rem 1rem 2rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }
}

.about-page {
  max-width: 1200px;
}

.about-intro {
  max-width: 800px;
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.about-intro p {
  font-size: 1.25rem;
  line-height: 1.6;
  color: var(--main-text);
  margin-bottom: 1.25rem;
}

.about-intro a {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
}

.about-intro a:hover {
  text-decoration: underline;
}

.social-links {
  display: flex;
  gap: 1rem;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 7rem;
  padding: 0.625rem 1.25rem;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--main-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9375rem;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-style: preserve-3d;
  perspective: 500px;
}

.social-link svg {
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.social-link:hover {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
  transform: translateY(-3px) rotateX(10deg) rotateY(-5deg);
  box-shadow:
    0 10px 20px rgba(217, 70, 239, 0.3),
    0 6px 6px rgba(217, 70, 239, 0.2);
}

.social-link:hover svg {
  transform: rotateY(360deg);
}

.about-content {
  max-width: 800px;
  font-size: 1.125rem;
  line-height: 1.75;
  color: var(--main-text);
}
