/* ============================================
 * HollowLight — Post & Markdown Styles
 * ZZZ InterKnot Forum Aesthetic
 *
 * § Markdown Content section is SHARED —
 *   page.ejs also <link>s this file.
 * ============================================ */

/* ─────────────────────────────────
 * § Markdown Content (Shared)
 * ───────────────────────────────── */

.markdown-content {
  font-size: 16px;
  line-height: 1.85;
  color: var(--hl-text, #fff);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.markdown-content > *:first-child { margin-top: 0; }
.markdown-content > *:last-child  { margin-bottom: 0; }

/* — Headings — */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  color: #fff;
  font-weight: 700;
  line-height: 1.3;
  margin: 2em 0 0.8em;
}

.markdown-content h1 {
  font-size: 1.75em;
  letter-spacing: -0.02em;
}

.markdown-content h2 {
  font-size: 1.45em;
  letter-spacing: -0.01em;
  padding-bottom: 0.35em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.markdown-content h3 { font-size: 1.2em; }
.markdown-content h4 { font-size: 1.05em; }

.markdown-content h5 {
  font-size: 0.95em;
  color: var(--hl-text-secondary, #b3b3b1);
}

.markdown-content h6 {
  font-size: 0.85em;
  color: var(--hl-text-secondary, #b3b3b1);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* — Paragraphs — */
.markdown-content p {
  margin: 0 0 1.2em;
}

/* — Links — */
.markdown-content a {
  color: var(--hl-accent, #fbfe00);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.markdown-content a:hover {
  border-bottom-color: var(--hl-accent, #fbfe00);
}

/* — Strong / Emphasis — */
.markdown-content strong { color: #fff; font-weight: 600; }
.markdown-content em     { font-style: italic; }

/* — Inline Code — */
.markdown-content code {
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
  font-size: 0.88em;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: #f0f0f0;
}

/* — Code Blocks — */
.markdown-content pre {
  margin: 1.5em 0;
  padding: 20px 24px;
  background: #0d0d0d;
  border-radius: 8px;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.markdown-content pre code {
  padding: 0;
  background: none;
  border-radius: 0;
  font-size: 14px;
  line-height: 1.6;
  color: #c9d1d9;
}

/* — Blockquote — */
.markdown-content blockquote {
  margin: 1.5em 0;
  padding: 16px 20px;
  border-left: 3px solid var(--hl-accent, #fbfe00);
  background: rgba(251, 254, 0, 0.03);
  border-radius: 0 8px 8px 0;
  color: var(--hl-text-secondary, #b3b3b1);
}

.markdown-content blockquote p:last-child {
  margin-bottom: 0;
}

.markdown-content blockquote blockquote {
  margin-top: 0.8em;
}

/* — Lists — */
.markdown-content ul,
.markdown-content ol {
  margin: 1em 0;
  padding-left: 2em;
}

.markdown-content li {
  margin-bottom: 0.4em;
  list-style: inherit;
}

.markdown-content li > ul,
.markdown-content li > ol {
  margin-top: 0.4em;
  margin-bottom: 0;
}

.markdown-content ul { list-style-type: disc; }
.markdown-content ol { list-style-type: decimal; }

/* — Tables — */
.markdown-content table {
  width: 100%;
  margin: 1.5em 0;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 14px;
}

.markdown-content thead {
  background: rgba(255, 255, 255, 0.06);
}

.markdown-content th,
.markdown-content td {
  padding: 10px 14px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.markdown-content th {
  font-weight: 600;
  color: #fff;
}

.markdown-content tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

/* — Images — */
.markdown-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1em 0;
  display: block;
}

/* — Horizontal Rule — */
.markdown-content hr {
  margin: 2.5em 0;
  border: none;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(255, 255, 255, 0.12),
    transparent
  );
}

/* ─────────────────────────────────
 * § Post Layout — Normal Mode
 * ───────────────────────────────── */

/* Hero Cover */
.post-hero {
  width: 100%;
  height: calc(55vh + var(--hl-header-height));
  min-height: calc(380px + var(--hl-header-height));
  max-height: calc(560px + var(--hl-header-height));
  background-size: cover;
  background-position: center top;
  position: relative;
  overflow: hidden;
}

.post-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.92) 0%,
    rgba(0, 0, 0, 0.5)  40%,
    rgba(0, 0, 0, 0.15) 100%
  );
  display: flex;
  align-items: flex-end;
}

.post-hero-inner {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 40px 48px;
}

.post-hero .post-title {
  font-size: 36px;
  font-weight: 800;
  color: #fff;
  margin: 0 0 16px;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

/* No-cover header */
.post-header-plain {
  padding: 80px 40px 48px;
  text-align: center;
}

.post-header-inner {
  max-width: 800px;
  margin: 0 auto;
}

.post-header-plain .post-title {
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  margin: 0 0 16px;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

/* Meta (date + tags) */
.post-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.post-header-plain .post-meta {
  justify-content: center;
}

.post-meta time {
  font-size: 14px;
  color: var(--hl-text-muted, #7e7e7e);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

/* Tag Pills (reused in post hero & header) */
.post-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag-pill {
  display: inline-block;
  padding: 3px 14px;
  font-size: 12px;
  color: var(--hl-accent, #fbfe00);
  background: rgba(251, 254, 0, 0.1);
  border: 1px solid rgba(251, 254, 0, 0.2);
  border-radius: 50px;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.tag-pill:hover {
  background: var(--hl-accent, #fbfe00);
  color: var(--hl-black, #000);
}

/* Post Body (content card) — ZZZ corner cut */
.post-body {
  max-width: 800px;
  margin: -32px auto 80px;
  padding: 48px;
  background: var(--hl-card, #1c1c1c);
  border-radius: var(--hl-radius, 20px);
  border-bottom-right-radius: 0;
  position: relative;
  z-index: 2;
}

.post-body::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 20px 20px;
  border-color: transparent transparent var(--hl-black, #000) transparent;
  pointer-events: none;
}

.post-header-plain + .post-body {
  margin-top: 0;
}

/* Window layout (hidden by default in normal mode) */
.post-window {
  display: none;
}

/* ─────────────────────────────────
 * § Responsive
 * ───────────────────────────────── */

@media (max-width: 768px) {
  .post-hero {
    height: 40vh;
    min-height: 280px;
  }

  .post-hero-inner {
    padding: 0 20px 32px;
  }

  .post-hero .post-title {
    font-size: 26px;
  }

  .post-header-plain {
    padding: 40px 20px 32px;
  }

  .post-header-plain .post-title {
    font-size: 26px;
  }

  .post-body {
    margin: -20px 16px 40px;
    padding: 28px 20px;
    border-radius: 16px;
    border-bottom-right-radius: 0;
  }

  .post-body::after {
    border-width: 0 0 16px 16px;
  }

  .markdown-content {
    font-size: 15px;
  }

  .markdown-content pre {
    padding: 16px;
    margin-left: -8px;
    margin-right: -8px;
    border-radius: 6px;
  }
}

/* ─────────────────────────────────
 * § Code Block Copy Button
 * ───────────────────────────────── */

.markdown-content pre {
  position: relative; /* anchor for copy button */
}

.hl-copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s, background 0.18s, color 0.18s, border-color 0.18s;
}

.markdown-content pre:hover .hl-copy-btn {
  opacity: 1;
}

.hl-copy-btn:hover {
  background: rgba(251, 254, 0, 0.12);
  border-color: rgba(251, 254, 0, 0.25);
  color: var(--hl-accent, #fbfe00);
}

.hl-copy-btn--done {
  background: rgba(34, 197, 94, 0.12) !important;
  border-color: rgba(34, 197, 94, 0.3) !important;
  color: #22c55e !important;
  opacity: 1 !important;
}
