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

/* Theme Variables */
:root {
  --bg-color: white;
  --text-primary: #000;
  --text-secondary: #333;
  --text-muted: #666;
  --text-light: #999;
  --text-lighter: #888;
  --border-color: #e0e0e0;
  --border-light: #e9e9e9;
  --border-lighter: #f0f0f0;
  --hover-bg: #f8f8f8;
  --hover-text: #999;
  --code-bg: #f5f5f5;
  --copied-bg: #f2f2f2;
  --checkbox-accent: #1877F2;
}

[data-theme="dark"] {
  --bg-color: #000;
  --text-primary: #e6edf3;
  --text-secondary: #c9d1d9;
  --text-muted: #8b949e;
  --text-light: #6e7681;
  --text-lighter: #484f58;
  --border-color: #30363d;
  --border-light: #21262d;
  --border-lighter: #161b22;
  --hover-bg: #161b22;
  --hover-text: #8b949e;
  --code-bg: #161b22;
  --copied-bg: #21262d;
  --checkbox-accent: #58a6ff;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button {
  font-family: inherit;
}

#blog-feed-view,
#article-view {
  flex: 1;
  position: relative;
}

/* Blog Header */
.blog-header {
  display: flex;
  align-items: center;
  padding: 0 30px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 65px;
  background: var(--bg-color);
  z-index: 100;
  transition: transform 0.2s ease-in-out;
}

.blog-header.header-hidden {
  transform: translateY(-100%);
}

.blog-title {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.blog-title:hover {
  cursor: pointer;
}

.blog-controls {
  display: flex;
  gap: 15px;
  justify-content: flex-end;
  padding-top: 120px;  
  padding-right: 40px;
  padding-bottom: 15px;
}

.control-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 0;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.control-btn:hover {
  color: var(--text-light);
}

.control-btn svg {
  width: 18px;
  height: 18px;
}

/* Filter Modal */
.filter-modal {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  pointer-events: none;
}

.filter-modal.active {
  display: block;
  pointer-events: auto;
}

.filter-modal-content {
  position: absolute;
  top: 155px;
  right: 100px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  width: 420px;
  max-height: 350px;
}

.filter-modal-header {
  display: none;
}

.filter-close {
  display: none;
}

.filter-sections {
  padding: 0;
  overflow: hidden;
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  max-height: 340px;
}

.filter-section {
  margin-bottom: 0;
  padding: 1rem 1.2rem;
  overflow-y: auto;
  border-right: 1px solid var(--border-light);
}

.filter-section:last-child {
  border-right: none;
}

.filter-section h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.filter-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  padding: 0.4rem 0.5rem;
  border-radius: 4px;
  transition: background 0.2s;
}

.filter-option:hover {
  background: var(--hover-bg);
}

.filter-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--checkbox-accent);
}

.filter-option label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
  flex: 1;
}

.filter-modal-footer {
  display: flex;
  justify-content: flex-end;
  padding: 0.75rem 1.2rem;
  border-top: 1px solid var(--border-color);
  gap: 0.5rem;
}

.filter-clear {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

.filter-clear:hover {
  background: var(--hover-bg);
}

.filter-apply {
  display: none;
}

/* Sort Modal */
.sort-modal {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  pointer-events: none;
}

.sort-modal.active {
  display: block;
  pointer-events: auto;
}

.sort-modal-content {
  position: absolute;
  top: 155px;
  right: 40px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  width: 200px;
}

.sort-options {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0;
}

.sort-option {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  cursor: pointer;
  padding: 0.6rem 1.2rem;
  transition: background 0.2s;
}

.sort-option:hover {
  background: var(--hover-bg);
}

.sort-option input[type="radio"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--checkbox-accent);
}

.sort-option label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
  flex: 1;
}

/* Feed Container */
.feed-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 30px 2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 5rem;
}

/* Post Card */
.post-card {
  background: var(--bg-color);
  border-radius: 0;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.post-card:hover .post-image {
  opacity: 1;
}

.post-card:hover .post-title {
  color: var(--text-primary);
}

.post-image {
  width: 100%;
  height: 400px;
  object-fit: cover;
  border-radius: 5px;
  transition: none;
}

.post-content {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.post-title {
  font-size: 1.7rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
  transition: color 0.3s ease;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.post-read-time {
  color: var(--text-light);
  font-size: 0.9rem;
  font-weight: 400;
}

.post-read-time::before {
  content: "•";
  margin-right: 0.7rem;
  color: var(--text-light);
}

.post-category {
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.9rem;
}

.post-date {
  color: var(--text-light);
  font-size: 0.9rem;
}

/* Article View */
.article-hero {
  max-width: none;  
  width: 100%;
  margin: 0 auto;
  padding: 100px 1rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.article-meta-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  font-size: 0.85rem;
  width: 100%;
}

.article-date {
  color: var(--text-primary);
  font-weight: 500;
}

.article-category {
  color: var(--text-light);
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s ease;
}

.article-category:hover {
  color: var(--text-primary);
}

.article-title {
  font-size: 3rem;
  font-weight: 400;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.2;
  max-width: 800px;
  margin-bottom: 20px;
  text-wrap: balance;
}

.article-image-wrapper {
  position: relative;
  width: 75vw;
  max-width: 1200px;
}

.article-hero-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center;
  border-radius: 5px;
  display: block;
  cursor: pointer;
}

.image-credit {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(20px);
  color: white;
  padding: 0.4rem 0.8rem;
  border-radius: 5px;
  font-size: 0.75rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  max-width: calc(100% - 24px);
  line-height: 1.4;
}

@media (hover: hover) {
  .article-image-wrapper:hover .image-credit {
    opacity: 1;
  }
}

.article-image-wrapper.show-credit .image-credit {
  opacity: 1;
}

.article-divider-section {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin: 2rem auto 0;
}

.article-divider {
  width: 55%;
  max-width: 900px;
  height: 1px;
  background: var(--border-light);
}

.article-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  justify-content: center;
}

.article-read-time {
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  margin-top: 16.3px;
}

.article-read-time::after {
  content: "•";
  margin-left: 1.5rem;
  color: var(--text-primary);
}

.article-content {
  max-width: 55%;
  width: 55%;
  margin: 1.5rem auto 4rem;
  padding: 0 2rem;
  text-align: left;
}

.article-content h1 {
  display: none;
}

.article-content h2 {
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-top: 3rem;
  margin-bottom: 1rem;
  font-weight: 700;
  text-align: left;
}

.article-content p {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 1.5rem;
  font-size: 1rem;
  text-align: left;
}

.article-content img {
  max-width: 100%;
  border-radius: 0;
  margin: 2rem auto;
  display: block;
}

.article-content code {
  background: var(--code-bg);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  color: var(--checkbox-accent);
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
}

.article-content pre {
  background: var(--code-bg);
  padding: 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 2rem 0;
  border: 1px solid var(--border-color);
}

/* Copy URL Button */
.copy-url-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 15px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 0px;
  border-radius: 5px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-url-btn:hover {
  color: var(--text-light);
}

.copy-url-btn svg {
  width: 18px;
  height: 18px;
}

.copied-message {
  display: none;
  background: var(--copied-bg);
  border: none;
  border-radius: 5px;
  color: var(--text-primary);
  padding: 6px;
  margin-top: 7.5px;
  margin-left: 5px;
  font-size: 0.75rem;
  position: absolute;
  left: calc(100% + 1rem);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  animation: fadeIn 0.2s ease;
}

.copied-message.show {
  display: block;
}

.copy-url-wrapper {
  position: relative;
  display: inline-flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}


footer {
  text-align: center;
  padding: 1rem 0;
  margin-top: 5rem;
  color: var(--text-lighter);
  font-size: 0.9rem;
  border-top: 1px solid var(--border-lighter);
}

/* Responsive Design */
@media (max-width: 768px) {
  .blog-header {
    padding: 0 20px;
    height: 55px;
  }

  .blog-title {
    font-size: 1.1rem;
  }

  .controls-wrapper {
    padding: 0 0;
    margin-bottom: 10px;
  }

  .blog-controls {
    padding-top: 100px;
    padding-right: 30px;
    gap: 1rem;
  }

  .control-btn {
    font-size: 0.75rem;
  }

  .control-btn svg {
    width: 14px;
    height: 14px;
  }

  .filter-modal-content {
    position: absolute;
    top: 140px;
    right: 20px;
    left: 20px;
    width: auto;
    max-height: 280px;
  }

  .filter-sections {
    max-height: 220px;
  }

  .filter-section {
    padding: 0.8rem 1rem;
  }

  .filter-section h4 {
    font-size: 0.8rem;
    margin-bottom: 0.6rem;
  }

  .filter-option {
    padding: 0.3rem 0.4rem;
    gap: 0.5rem;
  }

  .filter-option input[type="checkbox"] {
    width: 14px;
    height: 14px;
  }

  .filter-option label {
    font-size: 0.85rem;
  }

  .filter-modal-footer {
    padding: 0.6rem 1rem;
  }

  .filter-clear {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
  }

  .sort-modal-content {
    position: absolute;
    top: 140px;
    right: 20px;
    width: 180px;
  }
  
  .sort-option {
    padding: 0.5rem 1rem;
  }
  
  .sort-option input[type="radio"] {
    width: 14px;
    height: 14px;
  }
  
  .sort-option label {
    font-size: 0.85rem;
  }

  .post-title {
    font-size: 1rem;
  }

  .post-content {
    gap: 0.8rem;
  }

  .post-category {
    font-size: 0.8rem;
  }

  .post-date {
    font-size: 0.8rem;
  }

  .post-read-time {
    font-size: 0.8rem;
  }

  /* Article View Mobile */
  .article-hero {
    padding-top: 90px;
    gap: 1rem;
  }

  .article-meta-top {
    font-size: 0.8rem;
    gap: 0.6rem;
  }

  .article-title {
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 15px;
    padding: 0 1rem;
    text-wrap: balance;
  }

  .article-image-wrapper {
    width: 90vw;
  }

  .article-hero-image {
    aspect-ratio: 1 / 1;
  }

  .image-credit {
    font-size: 0.6rem;
    padding: 0.35rem 0.65rem;
    bottom: 10px;
    right: 10px;
  }

  .article-divider-section {
    margin-top: 1rem;
    gap: 1rem;
  }

  .article-divider-section {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
  }

  .article-divider {
    width: 95%;
  }

  .article-actions {
    gap: 1rem;
  }

  .article-read-time {
    font-size: 0.8rem;
  }

  .article-read-time::after {
    margin-left: 1rem;
  }

  .article-content {
    max-width: 100%;
    width: 95%;
    margin: 1.2rem auto 3rem;
    padding: 0 1.5rem;
  }

  .article-content h2 {
    font-size: 1rem;
    margin-top: 2rem;
    margin-bottom: 0.8rem;
  }

  .article-content p {
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 1.2rem;
  }

  .article-content code {
    font-size: 0.9rem;
  }

  .article-content pre {
    padding: 1rem;
    margin: 1.5rem 0;
    font-size: 0.85rem;
  }

  .copy-url-btn {
    font-size: 0.8rem;
    padding: 0px;
  }

  .copy-url-btn:hover {
    color: var(--text-primary);
  }

  .copy-url-btn svg {
    width: 16px;
    height: 16px;
  }

  .copied-message {
    font-size: 0.7rem;
    margin-left: 8px;
    left: calc(100% + 0.5rem);
  }

  footer {
    font-size: 0.75rem;
  }

}

