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

html, body {
  background-color: #0D0D12;
  /* background-color: #101015; */
  color: #E8E4DF;
}

body {
  font-family: 'Public Sans', sans-serif;
  line-height: 2.2rem;
  font-size: 18px;
  padding: 0 1rem;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Lexend Deca', sans-serif;
}

a {
  color: #C4A882;
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: #D4CFC8;
}

/* ── Header ── */
.site-header-wrap {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: #0D0D12;
}

header[role="banner"] {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.8rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.logo {
  display: flex;
  align-items: center;
}

.logo img {
  width: 75px;
  display: block;
}

/* Hamburger button */
.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s;
}

.nav-toggle:hover {
  border-color: rgba(196, 168, 130, 0.3);
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: #8A857E;
  position: relative;
  transition: background 0.2s;
}

.nav-toggle span::before,
.nav-toggle span::after {
  content: '';
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: #8A857E;
  transition: transform 0.2s;
}

.nav-toggle span::before {
  top: -5px;
}

.nav-toggle span::after {
  top: 5px;
}

/* Open state */
.nav-toggle.open span {
  background: transparent;
}

.nav-toggle.open span::before {
  top: 0;
  transform: rotate(45deg);
  background: #D4CFC8;
}

.nav-toggle.open span::after {
  top: 0;
  transform: rotate(-45deg);
  background: #D4CFC8;
}

/* Nav menu (dropdown) */
header[role="banner"] nav {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  background-color: #0D0D12;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.8rem 0;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  max-width: 1100px;
  margin: 0 auto;
}

header[role="banner"] nav.open {
  display: flex;
}

header[role="banner"] nav a {
  font-size: 15px;
  font-weight: 400;
  color: #8A857E;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: color 0.15s, background-color 0.15s;
}

header[role="banner"] nav a:hover {
  color: #D4CFC8;
  background-color: rgba(255, 255, 255, 0.04);
}

/* ── Main ── */
main {
  max-width: 1100px;
  margin: 2rem auto;
}

.content-with-sidebar {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  min-width: 0;
}

.content-full {
  max-width: 800px;
}

.main-content {
  min-width: 0;
}

.main-content h1 {
  font-family: 'Noto Serif', serif;
  font-size: 48px;
  font-weight: 500;
  color: #D4CFC8;
  margin-bottom: 1.5rem;
  letter-spacing: -0.3px;
  line-height: 3.4rem;
}

/* ── Post preview cards ── */
.post-preview {
  margin-bottom: 1.5rem;
  padding: 16px 18px;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  transition: border-color 0.15s, background-color 0.15s;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.post-preview:hover {
  background-color: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.post-preview-cover {
  width: 140px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

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

.post-preview h2 {
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.post-preview h2 a {
  color: #D4CFC8;
}

.post-preview h2 a:hover {
  color: #C4A882;
}

.post-preview time,
.post-preview .category {
  font-size: 14px;
  font-weight: 400;
  color: #6B6560;
  margin-right: 1rem;
}

.post-preview .category a {
  color: #8A857E;
}

.post-preview p {
  margin-top: 0.5rem;
  font-size: 16px;
  color: #8A857E;
  line-height: 2rem;
}

/* ── Single post ── */
.post-content {
  margin-top: 1.5rem;
  font-family: 'Noto Sans', sans-serif;
  font-size: 18px;
  line-height: 1.85rem;
  /* word-spacing: 2px; */
  color: #B0AAA3;
}

.post-content > section {
  margin-bottom: 3rem;
}

.post-content > section > section {
  margin-bottom: 2rem;
}

.post-content p {
  margin-bottom: 1.2rem;
  letter-spacing: 0.3px;
  font-weight: 200;
  
}

.post-content strong {
  color: #D4CFC8;
  font-weight: 600;
}

.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  font-family: 'Noto Serif', serif;
}

.post-content h2 {
  color: #D4CFC8;
  margin-top: 2rem;
  margin-bottom: 0.8rem;
  font-size: 30px;
  line-height: 2.6rem;
}

.post-content h3 {
  color: #D4CFC8;
  margin-top: 2rem;
  margin-bottom: 0.8rem;
  line-height: 2.1rem;
}

.post-content a {
  color: #C4A882;
  text-decoration: underline;
  text-decoration-color: rgba(196, 168, 130, 0.3);
}

.post-content a:hover {
  text-decoration-color: #C4A882;
}

.post-content code {
  font-size: 15px;
  padding: 2px 6px;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: #D4CFC8;
}

.post-content pre {
  padding: 16px;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  overflow-x: auto;
  margin-bottom: 1.2rem;
}

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

.post-content blockquote {
  font-family: 'Noto Serif', serif;
  font-size: 21px;
  padding: 12px 18px;
  border-left: 3px solid rgba(196, 168, 130, 0.3);
  background-color: rgba(196, 168, 130, 0.04);
  border-radius: 0 10px 10px 0;
  color: #d0ccc7;
  font-style: italic;
  letter-spacing: 0.4px;
  line-height: 2rem;
  /* word-spacing: 1px; */
  margin-bottom: 1.2rem;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  margin: 1rem 0;
}

.post-content ul, .post-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1.2rem;
}

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

.post-content hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 2.5rem 0;
}

.post-content .table-wrap {
  margin-bottom: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
}

.post-content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 15px;
  background-color: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 0;
}

@media (max-width: 768px) {
  .post-content .table-wrap {
    overflow-x: scroll;
    -webkit-overflow-scrolling: touch;
  }

  .post-content table {
    width: 700px;
  }
}

.post-content th,
.post-content td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.post-content th {
  font-weight: 600;
  color: #D4CFC8;
  background-color: rgba(255, 255, 255, 0.04);
}

.post-content td {
  color: #B0AAA3;
}

.post-content tr:last-child td {
  border-bottom: none;
}

.table-export-btn {
  display: inline-block;
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 6px 14px;
  font-size: 13px;
  font-family: 'Public Sans', sans-serif;
  color: #8A857E;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.table-export-btn:hover {
  color: #D4CFC8;
  border-color: rgba(196, 168, 130, 0.3);
}

/* ── Callout boxes ── */
.post-content .callout {
  display: flex;
  gap: 0.8rem;
  padding: 1rem 1.2rem;
  border-radius: 10px;
  margin-bottom: 1.5rem;
  border: 1px solid;
}

.post-content .callout-icon {
  font-size: 20px;
  line-height: 1.4;
  flex-shrink: 0;
}

.post-content .callout-body {
  flex: 1;
  min-width: 0;
}

.post-content .callout-body strong {
  display: block;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.3rem;
}

.post-content .callout-body p {
  margin-bottom: 0;
  font-size: 16px;
  line-height: 1.6rem;
}

.post-content .callout-tip {
  background-color: rgba(196, 168, 130, 0.06);
  border-color: rgba(196, 168, 130, 0.2);
}

.post-content .callout-tip strong {
  color: #C4A882;
}

.post-content .callout-warning {
  background-color: rgba(220, 160, 80, 0.06);
  border-color: rgba(220, 160, 80, 0.2);
}

.post-content .callout-warning strong {
  color: #DCA050;
}

.post-content .callout-hack {
  background-color: rgba(200, 120, 140, 0.06);
  border-color: rgba(200, 120, 140, 0.2);
}

.post-content .callout-hack strong {
  color: #C8788C;
}

/* ── Post header ── */
.post-cover {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: 12px;
  /* margin: 1.5rem 0; */
  margin-top: 1.5rem;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 1rem;
  margin-bottom: 1rem;
}

.post-meta time,
.post-meta .category,
.post-meta .author,
.post-meta .reading-time {
  font-size: 14px;
  color: #6B6560;
}

.post-meta .reading-time {
  opacity: 0.8;
}

.post-meta .category a,
.post-meta .author a {
  color: #8A857E;
}

.post-meta .author a:hover,
.post-meta .category a:hover {
  color: #C4A882;
}

/* ── Author page ── */
.author-header {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.author-avatar-lg {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.06);
}

.author-bio {
  font-size: 16px;
  color: #8A857E;
  margin-top: 0.3rem;
  line-height: 1.6;
}

/* ── Post list author ── */
.post-preview .author {
  font-size: 14px;
  color: #6B6560;
}

.post-preview .author a {
  color: #8A857E;
}

.post-preview .author a:hover {
  color: #C4A882;
}

/* ── Tags ── */
.post-tags {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 15px;
  color: #8A857E;
}

.tag {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 12px;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 14px;
  font-weight: 400;
  color: #8A857E;
  transition: border-color 0.15s, color 0.15s;
}

.tag:hover {
  border-color: rgba(196, 168, 130, 0.3);
  color: #D4CFC8;
  background-color: rgba(196, 168, 130, 0.06);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Sidebar ── */
.sidebar {
  padding-left: 1.5rem;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  position: sticky;
  top: 4.5rem;
  align-self: start;
}

.sidebar h3 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #6B6560;
  margin-bottom: 0.8rem;
}

.sidebar section {
  margin-bottom: 2.5rem;
}

.sidebar ul {
  list-style: none;
}

.sidebar ul li {
  margin-bottom: 0.8rem;
  line-height: 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.sidebar-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.sidebar ul li a {
  font-size: 15px;
  font-weight: 400;
  color: #8A857E;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sidebar ul li a:hover {
  color: #D4CFC8;
}

/* ── Pagination ── */
.pagination {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 16px;
  color: #6B6560;
}

.pagination a {
  color: #C4A882;
}

.pagination a:hover {
  color: #D4CFC8;
}

/* ── Category list ── */
.category-list {
  list-style: none;
}

.category-list li {
  margin-bottom: 0.6rem;
  font-size: 16px;
  color: #6B6560;
}

.category-list li a {
  font-weight: 500;
  color: #D4CFC8;
}

.category-list li a:hover {
  color: #C4A882;
}

/* ── Reading progress bar ── */
.reading-progress-bar {
  max-width: 1100px;
  margin: 0 auto;
  height: 3px;
  background: rgba(255, 255, 255, 0.04);
  pointer-events: none;
}

.reading-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #C4A882, #D4CFC8);
  transition: width 0.15s ease-out;
  border-radius: 0 2px 2px 0;
}

/* ── Continue reading prompt ── */
.continue-reading-prompt {
  position: fixed;
  bottom: 2rem;
  left: 1.5rem;
  transform: translateX(-120%);
  background: #1A1A22;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  z-index: 950;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.continue-reading-prompt.visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.continue-reading-prompt span {
  font-size: 14px;
  color: #B0AAA3;
  white-space: nowrap;
}

.continue-dismiss {
  background: none;
  border: none;
  color: #6B6560;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}

.continue-dismiss:hover {
  color: #D4CFC8;
}

@media (max-width: 768px) {
  .continue-reading-prompt {
    left: 0.75rem;
    bottom: 1.2rem;
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
    border-radius: 10px;
  }

  .continue-reading-prompt span {
    font-size: 12px;
  }

  .continue-dismiss {
    font-size: 16px;
  }
}

/* ── Back to top button ── */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #8A857E;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, border-color 0.15s, color 0.15s;
  z-index: 900;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover {
  border-color: rgba(196, 168, 130, 0.4);
  color: #D4CFC8;
}

@media (max-width: 768px) {
  .back-to-top {
    bottom: 1.2rem;
    right: 1.2rem;
    width: 50px;
    height: 50px;
  }
}

/* ── Footer ── */
footer[role="contentinfo"] {
  max-width: 1100px;
  margin: 3rem auto 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: #6B6560;
  font-size: 14px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .content-with-sidebar {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding-left: 0;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 1.5rem;
  }

  .main-content h1 {
    font-size: 32px;
    line-height: 2.4rem;
  }

  .post-content h2 {
    font-size: 24px;
    line-height: 2.2rem;
  }
}
