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

body {
  font-family: "Times New Roman", Times, serif;
  color: #555;
  background: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
.site-header {
  width: 100%;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}

.site-header nav {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1rem 1.5rem;
}

.nav-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1.5rem;
}

.nav-link {
  font-size: 1rem;
  color: #555;
  text-decoration: none;
  transition: color 0.2s;
}

@media (min-width: 640px) {
  .nav-link {
    font-size: 1.25rem;
  }
}

.nav-link:hover {
  color: #fb923c;
}

.nav-link.active {
  color: #ea580c;
}

/* ── Main layout ── */
.main-content {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 2rem 1.5rem;
}

.content-wrapper {
  width: 100%;
  max-width: 36rem;
  font-size: 0.9rem;
}

@media (min-width: 640px) {
  .content-wrapper {
    font-size: 1.125rem;
  }
}

/* ── Sections ── */
.about-section,
.stack-section {
  margin-top: 1.5rem;
}

.about-section h1,
.stack-section h1 {
  font-size: 1.25rem;
  font-weight: 600;
  font-family: "Times New Roman", serif;
  text-decoration: underline;
  color: #ea580c;
  margin-bottom: 0.75rem;
}

@media (min-width: 640px) {

  .about-section h1,
  .stack-section h1 {
    font-size: 1.5rem;
  }
}

.section-body {
  margin-left: 1rem;
}

.section-body p {
  line-height: 1.7;
  margin-bottom: 0.5rem;
}

.topic-list {
  list-style: disc;
  margin-left: 1.5rem;
  line-height: 1.8;
}

/* ── Table of Contents ── */
.toc-nav {
  display: none;
  position: fixed;
  left: 5rem;
  top: 5rem;
  width: 18rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1.25rem;
  max-height: calc(100vh - 7rem);
  overflow-y: auto;
  z-index: 50;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

@media (min-width: 1280px) {
  .toc-nav { display: block; }
}

.toc-title {
  font-size: 1rem;
  font-weight: 600;
  color: #ea580c;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #fed7aa;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-list li {
  margin: 0.15rem 0;
}

.toc-link {
  display: block;
  padding: 0.3rem 0.5rem;
  font-size: 0.875rem;
  color: #555;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}

.toc-link:hover {
  color: #ea580c;
  border-left-color: #ea580c;
  background: #fff7ed;
}

.toc-link.toc-active {
  color: #ea580c;
  border-left-color: #ea580c;
  background: #fff7ed;
}

.toc-h1 { font-weight: 600; }
.toc-h2 { font-weight: 500; }
.toc-h3 { font-weight: 400; font-size: 0.8rem; }

/* ── Blog post ── */
.post-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.post-meta-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 80%;
  max-width: 80%;
  padding: 1rem 0;
  position: relative;
  color: #6b7280;
}

@media (min-width: 768px) {
  .post-meta-bar { max-width: 60%; }
}

@media (min-width: 1024px) {
  .post-meta-bar { max-width: 40%; }
}

.back-arrow {
  position: absolute;
  left: 0;
  cursor: pointer;
  transition: transform 0.2s;
}

.back-arrow:hover {
  transform: scale(1.2);
}

.reading-time {
  font-size: 0.95rem;
}

.prose {
  width: 80%;
  max-width: 80%;
  margin-bottom: 1.5rem;
  font-size: 1rem;
  line-height: 1.75;
  color: #444;
}

@media (min-width: 768px) {
  .prose { max-width: 60%; }
}

@media (min-width: 1024px) {
  .prose { max-width: 40%; }
}

.prose h1, .prose h2, .prose h3 {
  color: #ea580c;
  font-family: "Times New Roman", serif;
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
}

.prose p {
  margin-bottom: 0.75rem;
}

.prose a {
  color: #ea580c;
  text-decoration: underline dotted;
}

.prose a:hover {
  color: #fb923c;
}

.prose ul, .prose ol {
  margin-left: 1.5rem;
  margin-top: 0.1rem;
  margin-bottom: 0.1rem;
}

.prose p + ul,
.prose p + ol {
  margin-top: -0.5rem;
}

.prose li {
  margin-bottom: 0;
}

.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }

.prose code {
  font-family: monospace;
  font-size: 0.9em;
  padding: 2px 6px;
  background: #f4f4f4;
  border-radius: 4px;
}

.prose pre {
  background: #fff;
  border: 1px solid #aaa;
  padding: 1rem;
  overflow-x: auto;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.prose pre code {
  background: none;
  padding: 0;
}

.prose hr {
  border: none;
  border-top: 1px solid #aaa;
  margin: 1rem 0;
}

.prose img {
  max-width: 100%;
  height: auto;
  margin: 0.5rem 0;
}

.prose blockquote {
  border-left: 4px solid #ea580c;
  margin-left: 0;
  padding-left: 1rem;
  color: #888;
  margin-bottom: 1rem;
}

.copy-button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 4px 6px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  color: #555;
  line-height: 0;
}

.copy-button:hover {
  background: #f0f0f0;
}

.post-pub-date {
  color: #6b7280;
  font-size: 0.9rem;
  margin-top: 2rem;
  margin-bottom: 2rem;
}

/* ── Blog index ── */
.blog-index {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.blog-index-title {
  font-size: 1.25rem;
  font-weight: 600;
  font-family: "Times New Roman", serif;
  text-decoration: underline;
  color: #ea580c;
  padding: 1rem 0 0.5rem;
}

@media (min-width: 640px) {
  .blog-index-title {
    font-size: 1.875rem;
  }
}

.post-list {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 80%;
  margin-bottom: 2.5rem;
}

@media (min-width: 768px) {
  .post-list { max-width: 60%; }
}

@media (min-width: 1024px) {
  .post-list { max-width: 40%; }
}

.post-item.hidden {
  display: none;
}

.post-link {
  display: block;
  padding: 0.5rem 0;
  text-decoration: none;
  color: inherit;
  transition: color 0.2s;
}

.post-link:hover {
  color: #fb923c;
}

.post-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.post-date {
  font-size: 0.875rem;
  color: #4b5563;
}

.load-more-btn {
  align-self: center;
  margin: 1.5rem 0;
  padding: 0.5rem 2rem;
  font-size: 1rem;
  background: #fb923c;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.load-more-btn:hover {
  background: #ea580c;
}