/*
Theme Name: Hunya Blog Theme
Description: A clean and modern WordPress theme with dark/light mode support
Version: 2.0
Author: Hunya and V0
*/

:root {
  --bg-color: #ffffff;
  --text-color: #333333;
  --text-muted: #666666;
  --border-color: #eeeeee;
  --border-light: #f0f0f0;
  --bg-secondary: #f9f9f9;
  --bg-tag: #f5f5f5;
  --bg-tag-hover: #e0e0e0;
  --link-color: #333333;
  --link-hover: #666666;
  --button-bg: #333333;
  --button-hover: #555555;
  --button-text: #ffffff;
}

[data-theme="dark"] {
  --bg-color: #1a1a1a;
  --text-color: #e8e8e8;
  --text-muted: #b0b0b0;
  --border-color: #404040;
  --border-light: #2a2a2a;
  --bg-secondary: #252525;
  --bg-tag: #333333;
  --bg-tag-hover: #404040;
  --link-color: #66b3ff;
  --link-hover: #4da6ff;
  --button-bg: #0066cc;
  --button-hover: #0052a3;
  --button-text: #ffffff;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans CJK SC",
    "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 40px;
  padding-bottom: 20px;
  position: relative;
}

.site-title {
  font-size: 2em;
  font-weight: bold;
  margin-bottom: 10px;
}

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

.site-description {
  color: var(--text-muted);
  font-size: 0.9em;
}

/* Theme Toggle */
.theme-toggle {
  position: absolute;
  top: 10px;
  right: 0;
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 4px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1em;
  transition: all 0.3s ease;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background-color: var(--bg-secondary);
  transform: scale(1.1);
}

.theme-icon {
  display: block;
  line-height: 1;
  font-size: 14px;
}

/* Navigation */
.main-navigation .nav-menu {
  list-style: none;
  display: flex;
  gap: 20px;
  margin-top: 15px;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
}

.main-navigation .nav-menu li {
  list-style: none;
}

.main-navigation .nav-menu a {
  text-decoration: none;
  color: var(--text-muted);
  padding: 5px 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.3s;
}

.main-navigation .nav-menu a:hover {
  border-bottom-color: var(--text-color);
}

/* Post List */
.post-list {
  list-style: none;
}

.post-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 15px 0;
  border-bottom: 1px solid var(--border-light);
  gap: 20px;
}

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

.post-title {
  flex: 1;
  min-width: 0;
}

.post-title a {
  text-decoration: none;
  color: var(--link-color);
  font-weight: 500;
  word-wrap: break-word;
  display: block;
}

.post-title a:hover {
  color: var(--link-hover);
}

.post-date {
  color: var(--text-muted);
  font-size: 0.9em;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Single Post */
.single-post {
  margin-bottom: 40px;
}

.post-header {
  margin-bottom: 30px;
}

.post-header h2 {
  font-size: 2em;
  margin-bottom: 15px;
  line-height: 1.3;
  word-wrap: break-word;
}

.post-meta {
  display: flex;
  gap: 20px;
  color: var(--text-muted);
  font-size: 0.9em;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.post-content {
  line-height: 1.8;
  margin-bottom: 30px;
}

.post-content p {
  margin-bottom: 1em;
}

.post-content h2,
.post-content h3,
.post-content h4 {
  margin: 1.5em 0 0.5em 0;
  color: var(--text-color);
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.post-content blockquote {
  border-left: 4px solid var(--border-color);
  padding-left: 20px;
  margin: 1.5em 0;
  color: var(--text-muted);
  font-style: italic;
}

.post-content code {
  background-color: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
  font-size: 0.9em;
}

.post-content pre {
  background-color: var(--bg-secondary);
  padding: 15px;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1em 0;
}

.post-content pre code {
  background: none;
  padding: 0;
}

.post-tags {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.post-tags strong {
  color: var(--text-muted);
  margin-right: 10px;
}

.post-tags a {
  display: inline-block;
  background: var(--bg-tag);
  color: var(--text-muted);
  text-decoration: none;
  padding: 3px 8px;
  margin-right: 5px;
  margin-bottom: 5px;
  border-radius: 3px;
  font-size: 0.85em;
  transition: background-color 0.3s ease;
}

.post-tags a:hover {
  background: var(--bg-tag-hover);
}

/* Comments */
.comments-area {
  margin-top: 50px;
  padding-top: 40px;
  border-top: 2px solid var(--border-color);
}

.comments-title {
  font-size: 1.4em;
  margin-bottom: 30px;
  color: var(--text-color);
  font-weight: 600;
}

.commentlist,
.comment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  margin-bottom: 40px;
}

.comment {
  padding: 15px;
  background-color: var(--bg-secondary);
  border-radius: 8px;
  border-left: 4px solid var(--border-color);
  transition: all 0.3s ease;
  margin-bottom: 20px;
}

.comment:hover {
  border-left-color: var(--text-color);
}

.comment-author,
.comment-meta {
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.comment-author cite,
.comment-author .fn {
  font-weight: 600;
  color: var(--text-color);
  font-size: 1.05em;
  font-style: normal;
}

.comment-meta a {
  color: var(--text-muted);
  font-size: 0.85em;
  text-decoration: none;
  white-space: nowrap;
}

.comment-meta a:hover {
  color: var(--text-color);
}

.comment-content {
  line-height: 1.7;
  color: var(--text-color);
  margin-bottom: 15px;
}

.comment-content p {
  margin-bottom: 1em;
}

.comment-content p:last-child {
  margin-bottom: 0;
}

.comment-reply-link {
  display: inline-block;
  padding: 8px 15px;
  background: var(--bg-tag);
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 4px;
  font-size: 0.85em;
  transition: all 0.3s ease;
}

.comment-reply-link:hover {
  background: var(--bg-tag-hover);
  color: var(--text-color);
}

.children {
  list-style: none;
  margin-top: 25px;
  margin-left: 30px;
  border-left: 2px solid var(--border-light);
  padding-left: 25px;
}

.children .comment {
  background-color: var(--bg-color);
  border-left-width: 3px;
}

/* Comment Form */
.comment-respond {
  margin-top: 40px;
  padding: 30px;
  background: var(--bg-secondary);
  border-radius: 8px;
}

.comment-reply-title {
  font-size: 1.2em;
  margin-bottom: 25px;
  color: var(--text-color);
  font-weight: 600;
}

.comment-form {
  display: grid;
  gap: 20px;
}

.comment-form-author,
.comment-form-email,
.comment-form-url,
.comment-form-comment {
  display: grid;
  gap: 8px;
}

.comment-form label {
  font-weight: 500;
  color: var(--text-color);
  font-size: 0.9em;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-size: 1em;
  transition: border-color 0.3s ease;
  font-family: inherit;
}

.comment-form textarea {
  line-height: 1.6;
  resize: vertical;
  min-height: 120px;
}

.comment-form input:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: var(--text-color);
}

.comment-form input[type="submit"] {
  padding: 12px 25px;
  background: var(--button-bg);
  color: var(--button-text);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95em;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

.comment-form input[type="submit"]:hover {
  background: var(--button-hover);
}

.comment-notes {
  font-size: 0.85em;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* Pagination */
.pagination {
  margin-top: 40px;
  text-align: center;
}

.page-numbers {
  display: inline-block;
  padding: 10px 15px;
  text-decoration: none;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  transition: all 0.3s ease;
  font-size: 0.9em;
  min-width: 44px;
  text-align: center;
  margin: 0 2px;
}

.page-numbers:hover {
  background: var(--bg-secondary);
  color: var(--text-color);
  border-color: var(--text-color);
}

.page-numbers.current {
  background: var(--button-bg);
  color: var(--button-text);
  border-color: var(--button-bg);
  font-weight: 500;
}

.page-numbers.dots {
  border: none;
  background: none;
  color: var(--text-muted);
}

/* Footer */
.site-footer {
  margin-top: 60px;
  padding-top: 30px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9em;
}

/* Dark Mode Optimizations */
[data-theme="dark"] img {
  opacity: 0.9;
}

[data-theme="dark"] img:hover {
  opacity: 1;
}

[data-theme="dark"] .post-content a,
[data-theme="dark"] .comment-content a,
[data-theme="dark"] .post-meta a,
[data-theme="dark"] .comment-meta a {
  color: #66b3ff;
}

[data-theme="dark"] .post-content a:hover,
[data-theme="dark"] .comment-content a:hover,
[data-theme="dark"] .post-meta a:hover,
[data-theme="dark"] .comment-meta a:hover {
  color: #4da6ff;
}

[data-theme="dark"] .post-tags a {
  background: #333333;
  color: #b0b0b0;
}

[data-theme="dark"] .post-tags a:hover {
  background: #404040;
  color: #e8e8e8;
}

/* Focus States */
button:focus,
input:focus {
  outline: 2px solid var(--text-color);
  outline-offset: 2px;
}

a:focus {
  outline: none;
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 15px;
  }

  .post-item {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
  }

  .post-title {
    flex: 1;
    min-width: 0;
  }

  .post-date {
    flex-shrink: 0;
    font-size: 0.8em;
    white-space: nowrap;
  }

  .comment {
    padding: 12px;
  }

  .comment-respond {
    padding: 20px 15px;
  }

  .children {
    margin-left: 15px;
    padding-left: 15px;
  }

  .comment-author,
  .comment-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
}

/* Accessibility */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000000;
    --border-light: #333333;
  }

  [data-theme="dark"] {
    --border-color: #ffffff;
    --border-light: #cccccc;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
