.back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  color: var(--color-blue);
  text-decoration: none;
  transition: background 0.2s ease;
  margin-bottom: 2rem;
}
.back-button:hover {
  background: rgba(255, 255, 255, 0.05);
}
.back-button svg {
  width: 2rem;
  height: 2rem;
  transform: scaleX(-1);
}

/* --- Post List (index page) --- */
.post-list {
  display: flex;
  flex-direction: column;
}

.post-item {
  display: block;
  position: relative;
  padding: 3rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  text-decoration: none;
  color: var(--color-white);
  transition: background 0.2s ease;
}
.post-item:last-child {
  border-bottom: none;
}

/* Right-to-left blue line fill on hover (from .text-body ul li::after) */
.post-item::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background-color: var(--color-blue);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.post-item:hover::after,
.post-item:focus-within::after {
  transform: scaleX(1);
}

.post-item-title {
  font-size: 3rem;
  line-height: 1.25;
  margin-bottom: 1rem;
  break-inside: avoid;
}

.post-date {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 1rem;
}

.post-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

/* --- Post Reader (post.html) --- */
body.post-reader {
  overflow-x: hidden;
  overflow-y: auto;
  height: auto;
  padding: 0;
}

body.post-reader .sidebar-fixed {
  display: none;
}

.back-button-float {
  position: fixed;
  top: 2rem;
  left: 2rem;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  color: var(--color-white);
  text-decoration: none;
  background: var(--color-blue);
  transition: background 0.2s ease;
}
.back-button-float:hover {
  background: rgba(255, 255, 255, 0.1);
}
.back-button-float svg {
  width: 1.5rem;
  height: 1.5rem;
  transform: scaleX(-1);
}

.post-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem;
}

@media (min-width: 769px) {
  .post-container {
    padding: 5rem;
  }
}

.post-reader-title {
  font-size: 5rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.post-reader-date {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 3rem;
}

.post-reader-content {
  padding: 1rem 0;
  margin-bottom: 3rem;
}

/* Markdown rendered content */
.post-reader-content h1 {
  font-size: 2.5rem;
  line-height: 1.2;
  margin: 4rem 0 1.5rem;
  letter-spacing: -0.02em;
}

.post-reader-content h2 {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  line-height: 1.3;
  margin: 2rem 0 1rem;
}

.post-reader-content h3 {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  line-height: 1.3;
  margin: 2rem 0 1rem;
}

.post-reader-content p {
  font-size: 1.3rem;
  line-height: 1.75;
  margin-bottom: 2rem;
}

.post-reader-content ul,
.post-reader-content ol {
  font-size: 1.25rem;
  line-height: 1.75;
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

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

.post-reader-content li::marker {
  color: var(--color-cyan);
}

.post-reader-content blockquote {
  border-left: 4px solid var(--color-blue);
  padding: 1rem 0 0.75rem 1.5rem;
  margin: 2rem 0;
  color: rgba(255, 255, 255, 0.7);
}

.post-reader-content blockquote p {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.post-reader-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}

.post-reader-content pre {
  background: rgba(255, 255, 255, 0.05);
  padding: 1.5rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  border-radius: 4px;
}

.post-reader-content pre code {
  background: none;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1.6;
}

.post-reader-content .img-placeholder {
  position: relative;
  margin: 5rem 0;
  border-radius: 4px;
  overflow: hidden;
  background: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.12) 0px,
    rgba(255, 255, 255, 0.12) 2px,
    transparent 1px,
    transparent 14px
  );
  background-size: 20px 20px;
  animation: slide-diagonal 4s linear infinite;
  min-height: 200px;
}

.post-reader-content .img-placeholder.loaded {
  background: none;
  animation: none;
  min-height: 0;
}

.post-reader-content .img-placeholder img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
  margin: 0;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.post-reader-content .img-placeholder.loaded img {
  opacity: 1;
}

.post-reader-content video {
  max-width: 100%;
  aspect-ratio: 16 / 9;
  margin: 1.5rem 0;
  display: block;
}

.post-reader-content iframe {
  max-width: 100%;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 1.5rem 0;
  display: block;
  border: none;
  border-radius: 4px;
}

.post-reader-content hr {
  border: none;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
  margin: 3rem 0;
}

.post-reader-content a {
  color: var(--color-cyan);
  text-decoration: none;
  transition: color 0.25s ease;
}
.post-reader-content a:hover {
  color: var(--color-white);
}

.post-reader-content strong {
  font-weight: 400;
  color: var(--color-white);
}

.post-reader-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

/* --- Pattern Divider (use <div class="pattern-break"></div> in markdown) --- */
.post-reader-content .pattern-break {
  width: 100%;
  height: 8rem;
  margin: 8rem 0;
  background-clip: content-box;
  display: block;
  background: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.12) 0px,
    rgba(255, 255, 255, 0.12) 2px,
    transparent 1px,
    transparent 14px
  );
  background-size: 20px 20px;
  animation: slide-diagonal 4s linear infinite;
  pointer-events: none;
}

/* --- CTA Button (use <a class="post-cta" href="...">Label ↗</a> in markdown) --- */
.post-reader-content .post-cta-wrap {
  position: relative;
  display: inline-block;
  margin: 1.5rem 0 3rem 0;
}

.post-reader-content .post-cta-wrap::after {
  content: '';
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  right: -1.5rem;
  bottom: -1.5rem;
  background: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.12) 0px,
    rgba(255, 255, 255, 0.12) 2px,
    transparent 1px,
    transparent 14px
  );
  background-size: 20px 20px;
  animation: slide-diagonal 4s linear infinite;
  z-index: 1;
  pointer-events: none;
}

.post-reader-content .post-cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 3rem;
  padding: 1.25rem 1.75rem;
  background: var(--color-blue);
  color: var(--color-white);
  font-family: var(--font-mono);
  font-size: 1.25rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-decoration: none;
  cursor: pointer;
  z-index: 2;
  transition: background 0.2s ease, outline 0.2s ease;
}

.post-reader-content .post-cta:hover {
  background: var(--color-black);
  color: var(--color-white);
  outline: 4px solid var(--color-blue);
  outline-offset: 1px;
}

.post-reader-content .post-cta-dark {
  background: var(--color-black);
  outline: 2px solid rgba(255, 255, 255, 0.12);
}

.post-reader-content .post-cta-dark:hover {
  outline: 4px solid var(--color-blue);
}

/* --- Post Not Found --- */
.post-not-found {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.5);
}

/* --- Mobile overrides --- */
@media (max-width: 768px) {
  html {font-size: 14px;
  }

  .post-container {
    padding-top: 5rem;
  }

  .post-item-title {
    font-size: 2.5rem;
  }

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

  .post-item .text-tag {
    font-size: 0.875rem;
    padding: 0.75rem 0.75rem;
  }

  body.post-reader {
    padding: 0;
  }

  .post-reader-title {
    font-size: 3.5rem;
  }

  .back-button-float {
    top: 1rem;
    left: 1rem;
  }
}
