/* ══════════════════════════════════════════════
   DevoongLog · post.css
   Post detail page styles
══════════════════════════════════════════════ */

/* ─── POST MAIN ─── */
.post-main {
  flex: 1;
  min-width: 0;
}

/* ─── ADMIN TOOLBAR (fixed bottom bar) ─── */
.admin-toolbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-bright);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
}
.admin-toolbar.hidden { display: none !important; }

.toolbar-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--accent);
  margin-right: auto;
}

.toolbar-btn {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-2);
  transition: var(--transition);
}
.toolbar-btn:hover { color: var(--accent); border-color: var(--border-bright); }
.toolbar-btn.danger:hover { color: #f87171; border-color: rgba(248, 113, 113, 0.3); }

/* ─── POST LAYOUT (legacy, kept for compatibility) ─── */
.post-layout {
  display: flex;
  gap: 0;
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--header-h) 0 0;
  position: relative;
  z-index: 2;
  align-items: flex-start;
}

/* Reading progress bar */
.read-progress {
  position: fixed;
  top: var(--header-h);
  left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--green-700), var(--accent), var(--green-300));
  z-index: 101;
  transition: width 0.1s linear;
  box-shadow: 0 0 8px var(--green-glow);
}

/* ─── ARTICLE ─── */
.post-article {
  flex: 1;
  min-width: 0;
  padding: 40px 48px 80px;
  max-width: 760px;
  margin: 0 auto;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-3);
  text-decoration: none;
  margin-bottom: 32px;
  transition: var(--transition);
  border: 1px solid transparent;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}
.back-link:hover {
  color: var(--accent);
  border-color: var(--border);
  background: var(--accent-dim);
  text-decoration: none;
}
.back-link svg { width: 14px; height: 14px; }

/* Post header */
.post-header { margin-bottom: 40px; }

.post-meta-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.post-category-badge {
  font-family: var(--font-code);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--tag-border);
  padding: 3px 10px;
  border-radius: 20px;
}

.post-date, .post-read-time {
  font-family: var(--font-code);
  font-size: 12px;
  color: var(--text-muted);
}

.post-title {
  font-family: var(--font-mono);
  font-size: clamp(26px, 4vw, 42px);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -1px;
  margin-bottom: 16px;
}

.post-excerpt-full {
  font-size: 17px;
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 16px;
  padding-left: 16px;
  border-left: 3px solid var(--accent);
}

.post-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 24px;
}
.post-tags-list .post-tag {
  font-family: var(--font-code);
  font-size: 11px;
  color: var(--text-3);
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  padding: 3px 10px;
  border-radius: 20px;
}
.post-tags-list .post-tag::before { content: '#'; opacity: 0.5; margin-right: 1px; }

.post-cover-wrap {
  margin-bottom: 24px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}
.post-cover {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  display: block;
}

/* Admin edit bar */
.admin-edit-bar {
  display: flex;
  gap: 10px;
  padding: 12px 0;
  margin-bottom: 16px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.btn-edit-post, .btn-delete-post {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 16px;
  font-size: 13px;
  color: var(--text-2);
  transition: var(--transition);
}
.btn-edit-post:hover { color: var(--accent); border-color: var(--border-bright); }
.btn-delete-post:hover { color: #f87171; border-color: rgba(248, 113, 113, 0.3); }

/* Post body */
.post-body {
  font-size: 16px;
  line-height: 1.85;
  color: var(--text);
}

.post-body h2 {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  margin: 40px 0 16px;
  color: var(--text);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.5px;
}

.post-body h3 {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  margin: 32px 0 12px;
  color: var(--text);
}

.post-body h4 {
  font-size: 17px;
  font-weight: 700;
  margin: 24px 0 10px;
  color: var(--text);
}

.post-body p { margin-bottom: 16px; }

.post-body a { color: var(--accent); }
.post-body a:hover { text-decoration: underline; }

.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 20px;
  margin: 20px 0;
  background: var(--accent-dim);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--text-2);
}

.post-body pre {
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  margin: 20px 0;
  position: relative;
}

.post-body pre code {
  font-family: var(--font-code);
  font-size: 13.5px;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  line-height: 1.7;
}

.post-body :not(pre) > code {
  font-family: var(--font-code);
  font-size: 13px;
  color: var(--accent);
  background: var(--bg-4);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
}

.post-body img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 20px auto;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: block;
}

.post-body ul, .post-body ol {
  padding-left: 24px;
  margin: 16px 0;
}

.post-body li {
  margin-bottom: 6px;
  line-height: 1.7;
}

.post-body ul li::marker { color: var(--accent); }
.post-body ol li::marker { color: var(--accent); font-family: var(--font-mono); }

.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.post-body th, .post-body td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.post-body th {
  background: var(--bg-3);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-3);
}
.post-body tr:last-child td { border-bottom: none; }
.post-body tr:hover td { background: var(--bg-2); }

.post-body .file-attachment {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-2);
  margin: 6px 4px;
  text-decoration: none;
  transition: var(--transition);
}
.post-body .file-attachment:hover { border-color: var(--border-bright); color: var(--accent); text-decoration: none; }
.post-body .file-attachment::before { content: '📎'; font-size: 14px; }

/* Share */
.post-share {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 48px 0 32px;
  padding: 20px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.share-label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--text-3);
  text-transform: uppercase;
  margin-right: auto;
}
.share-btn {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.share-btn:hover { border-color: var(--border-bright); color: var(--accent); text-decoration: none; }

/* Prev/Next */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 48px;
}

.post-nav-btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: var(--transition);
}
.post-nav-btn:hover {
  border-color: var(--border-bright);
  background: var(--bg-3);
  text-decoration: none;
}
.post-nav-btn:last-child { text-align: right; }

.pnav-dir {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--accent);
  text-transform: uppercase;
}
.pnav-title {
  font-size: 13px;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─── TOC ─── */
.toc-sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--header-h) + 32px);
  max-height: calc(100vh - var(--header-h) - 64px);
  overflow-y: auto;
  padding: 32px 24px;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.toc-sidebar:hover { scrollbar-color: var(--scrollbar-thumb) transparent; }

.toc-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.toc-link {
  display: block;
  font-size: 12px;
  color: var(--text-3);
  text-decoration: none;
  padding: 5px 8px;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: var(--transition);
  line-height: 1.4;
  margin-bottom: 2px;
}
.toc-link:hover {
  color: var(--accent);
  border-left-color: var(--border-bright);
  background: var(--accent-dim);
  text-decoration: none;
}
.toc-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-dim);
}
.toc-link.h3 { padding-left: 18px; font-size: 11px; }
.toc-link.h4 { padding-left: 28px; font-size: 11px; opacity: 0.8; }

/* ─── COMMENTS ─── */
.comments-section {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 48px 80px;
  position: relative;
  z-index: 2;
}

.comments-title {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

#giscusContainer {
  min-height: 100px;
}

/* Giscus theme override */
.giscus-frame {
  border-radius: var(--radius-lg) !important;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 1024px) {
  .toc-sidebar { display: none; }
  .post-article { max-width: 100%; padding: 32px 32px 64px; }
}

@media (max-width: 600px) {
  .post-article { padding: 20px 16px 48px; }
  .comments-section { padding: 0 16px 48px; }
  .post-nav { grid-template-columns: 1fr; }
  .post-title { font-size: 26px; }
}
