:root {
  --bg-color: #000000;
  --text-color: #ffffff;
  --accent-color: #888888;
  --link-color: #ffffff;
  --font-main: "JetBrains Mono", monospace;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-main);
  line-height: 1.6;
  font-weight: 300;
  font-size: 1.125rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: 5rem;
  overflow-x: hidden;
}

@media (max-width: 768px) {
  body {
    padding-top: 4.5rem;
  }
}

body.is-home {
  padding-top: 0;
  overflow-y: auto;
}

@media (max-width: 768px) {
  body.is-home {
    padding-top: 0;
    overflow-y: auto;
  }
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

a:hover {
  opacity: 0.7;
}

/* Header */
.site-header {
  padding: 1rem 2rem;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  background-color: var(--bg-color);
  z-index: 102;
}

.header-container {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.header-logo {
  font-weight: 500;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}

.header-nav {
  display: flex;
  gap: 1.5rem;
  font-size: 1.1rem;
  font-weight: 400;
}

.hamburger {
  display: none;
  position: fixed;
  top: 0.65rem;
  right: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.25rem;
  transition: background-color 0.2s ease;
  z-index: 101;
}

.hamburger:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--text-color);
  margin: 5px 0;
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}

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

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

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

.mobile-nav {
  display: none;
}

.mobile-nav-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

.mobile-nav-overlay.active {
  display: block;
  opacity: 1;
  visibility: visible;
}

@media (max-width: 768px) {
  .hamburger {
    display: block;
    position: fixed;
    top: 0.65rem;
    right: 0.5rem;
    z-index: 104;
  }

  .site-header {
    padding: 0.5rem 0.75rem;
    top: 0.5rem;
  }

  .header-nav {
    display: none;
  }

  .mobile-nav {
    display: flex;
    position: fixed;
    top: 0;
    right: -85%;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    background-color: var(--bg-color);
    flex-direction: column;
    padding: 4.5rem 1.25rem 2rem;
    gap: 0;
    z-index: 103;
    transition: right 0.3s ease;
    border-left: 1px solid #222;
  }

  .mobile-nav.active {
    right: 0;
  }

  .mobile-nav a {
    font-size: 1.1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #222;
  }
}

/* Home Layout */
.home-container {
  text-align: center;
  padding: 2rem;
  max-width: 600px;
  margin: 0 auto;
  min-height: calc(100vh - 5rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .home-container {
    min-height: 100vh;
    padding: 1rem;
  }
}

.home-content {
  margin-top: -2rem;
}

.logo {
  font-size: 4rem;
  font-weight: 500;
  letter-spacing: -0.05em;
  margin-bottom: 0.5rem;
}

.tagline {
  color: var(--accent-color);
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.tagline:last-of-type {
  margin-bottom: 3rem;
}

.home-nav {
  display: flex;
  justify-content: center;
  gap: 2rem;
  font-size: 0.9rem;
}

/* Page Layout */
.page-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 8rem 2rem 4rem;
  /* Added top padding for fixed header */
  width: 100%;
}

.page-header {
  margin-bottom: 3rem;
  /* Removed margin-bottom 4rem to reduce gap after removing back link */
}

.page-title {
  font-size: 3rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
  text-transform: lowercase;
}

.blog-title {
  font-size: 3rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.page-meta {
  color: var(--accent-color);
  font-size: 0.85rem;
}

.content {
  font-size: 1.2rem;
}

.content h2 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  font-weight: 500;
}

.content p {
  margin-bottom: 1.5rem;
  font-weight: 400;
}

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

.post-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid #222;
}

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

.post-link {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  text-decoration: none;
}

.post-link:hover .post-title {
  opacity: 0.7;
}

.post-date {
  color: var(--accent-color);
  font-size: 0.85rem;
  min-width: 100px;
  text-align: right;
}

.post-title {
  font-weight: 400;
}

.post-description {
  color: var(--accent-color);
  font-size: 0.9rem;
  margin-top: 0.25rem;
  margin-bottom: 0;
}

.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  font-size: 0.9rem;
  color: var(--accent-color);
}

/* Tags */
.post-tags {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.post-tag {
  color: var(--accent-color);
  font-size: 0.85rem;
  text-decoration: none;
  padding: 0.2rem 0;
}

.post-tag:hover {
  color: var(--link-color);
  text-decoration: underline;
}

/* Archive Tags Filter */
.archive-tags {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.archive-tags-label {
  font-size: 0.9rem;
  color: var(--text-color);
  margin-right: 0.5rem;
}

/* Code Blocks */
.content pre {
  background-color: #1a1a1a;
  border-radius: 0.5rem;
  padding: 1rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.content pre code {
  background-color: transparent;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.content code {
  background-color: #1a1a1a;
  padding: 0.2rem 0.4rem;
  border-radius: 0.25rem;
  font-size: 0.9em;
}

/* Lists */
.content ul {
  list-style-type: disc;
  margin-left: 1.5rem;
  margin-bottom: 1.5rem;
}

.content ol {
  list-style-type: decimal;
  margin-left: 1.5rem;
  margin-bottom: 1.5rem;
}

.content li {
  margin-bottom: 0.5rem;
}

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

/* Code Blocks with Copy Button */
.code-block-wrapper {
  position: relative;
}

.copy-button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: transparent;
  border: 1px solid #444;
  color: #888;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.copy-button:hover {
  border-color: #666;
  color: #fff;
}

.copy-button.copied {
  border-color: #4caf50;
  color: #4caf50;
}

/* Images */
.content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2rem auto;
}

/* Comments Section */
.comments-section {
  margin-top: 4rem;
}

.comments-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(to right, transparent, #333, transparent);
  margin-bottom: 2rem;
}

.comments-title {
  font-size: 1.5rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  color: var(--text-color);
}

/* Giscus iframe adjustments */
.giscus {
  margin-top: 1rem;
}

.giscus-frame {
  background: transparent !important;
}

@media (min-width: 769px) {
  .hamburger {
    display: none;
  }
}

@media (max-width: 768px) {
  .hamburger {
    display: block;
  }

  body {
    padding-top: 4.5rem;
  }

  .page-container {
    padding: 0 1.5rem 3rem;
  }

  .header-container {
    padding: 0 0.5rem;
  }

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

  .logo {
    font-size: 3rem;
  }
}

@media (max-width: 480px) {
  :root {
    --font-size-base: 1rem;
  }

  body {
    font-size: var(--font-size-base);
  }

  .page-container {
    padding: 5rem 1rem 2rem;
  }

  .header-padding {
    padding: 0.75rem;
  }

  .logo {
    font-size: 2.5rem;
  }

  .page-title,
  .blog-title {
    font-size: 2rem;
  }

  .tagline {
    font-size: 0.8rem;
  }

  .home-nav {
    gap: 1rem;
    font-size: 0.85rem;
  }

  .post-link {
    flex-direction: column;
    gap: 0.25rem;
  }

  .post-date {
    text-align: left;
  }
}
