/* =============================================================================
   SINGLE.CSS — Blogar Theme  v2
   Depends on: frontpage.css, archive.css
   Single-specific blocks only — no duplication of shared rules.

   Breakpoints
     Desktop     ≥ 1200px  (default)
     Desktop-SM  1200–1599px
     Tablet      768–1199px
     Mobile      ≤ 767px
     Mobile-XS   ≤ 575px
   ============================================================================= */

/* =============================================================================
   FEATURED IMAGE
   ============================================================================= */
.single-post-thumbnail {
  overflow: hidden;
  border-radius: var(--radius);
  line-height: 0;
  aspect-ratio: 1230 / 615;
}

.single-post-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: var(--radius);
}

/* =============================================================================
   POST HEADER
   ============================================================================= */
.single-post-title {
  margin: 16px 0 0;
  color: var(--color-heading);
  font-size: 38px;
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.01em;
}

.single-post-meta.post-meta-wrapper {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 16px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--color-lighter);
}

.single-post-meta .post-meta {
  min-width: 0;
}
.single-post-meta .post-meta .content {
  min-width: 0;
}
.single-post-meta .post-author-name {
  margin: 0 0 4px;
}

.single-post-meta .post-meta-list {
  flex-wrap: nowrap;
  white-space: nowrap;
}
.single-post-meta .post-meta-list li {
  white-space: nowrap;
  color: #666;
  font-size: 12px;
  line-height: 1.3;
}

.single-post-meta .social-share-transparent.justify-content-end {
  flex: 0 0 auto;
  margin-left: auto;
  justify-content: flex-end;
}

/* =============================================================================
   POST CONTENT — the_content() prose
   ============================================================================= */
.single-post-content {
  margin-top: 36px;
  color: var(--color-body, #65676b);
  font-size: 16px;
  line-height: 1.8;
}

.single-post-content p {
  margin: 0 0 1.4em;
}
.single-post-content p:last-child {
  margin-bottom: 0;
}

.single-post-content h2,
.single-post-content h3,
.single-post-content h4,
.single-post-content h5,
.single-post-content h6 {
  margin: 1.6em 0 0.6em;
  color: var(--color-heading);
  font-weight: 700;
  line-height: 1.28;
  scroll-margin-top: 96px; /* offset for sticky header */
}

.single-post-content h2 {
  font-size: 28px;
}
.single-post-content h3 {
  font-size: 24px;
}
.single-post-content h4 {
  font-size: 20px;
}
.single-post-content h5 {
  font-size: 18px;
}
.single-post-content h6 {
  font-size: 16px;
}

.single-post-content ul {
  margin: 0 0 1.4em 1.5em;
  padding: 0;
  list-style: disc;
}
.single-post-content ol {
  margin: 0 0 1.4em 1.5em;
  padding: 0;
  list-style: decimal;
}
.single-post-content li {
  margin-bottom: 0.4em;
}

.single-post-content img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 1.4em 0;
}

.single-post-content figure {
  margin: 1.4em 0;
}
.single-post-content figcaption {
  margin-top: 8px;
  color: var(--color-midgray);
  font-size: 13px;
  text-align: center;
}

.single-post-content blockquote {
  margin: 1.6em 0;
  padding: 20px 30px;
  color: var(--color-heading);
  background: var(--color-lightest);
  border-left: 4px solid var(--color-primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 18px;
  font-style: italic;
  line-height: 1.6;
}

.single-post-content blockquote p {
  margin: 0;
}

.single-post-content a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s ease;
}
.single-post-content a:hover {
  color: var(--color-secondary);
}

.single-post-content table {
  width: 100%;
  margin: 1.4em 0;
  border-collapse: collapse;
  font-size: 15px;
}
.single-post-content th,
.single-post-content td {
  padding: 10px 14px;
  border: 1px solid var(--color-lighter);
  text-align: left;
}
.single-post-content th {
  color: var(--color-heading);
  background: var(--color-lightest);
  font-weight: 700;
}

.single-post-content pre,
.single-post-content code {
  background: var(--color-lightest);
  border-radius: var(--radius-small, 4px);
  font-family: Menlo, Consolas, Monaco, monospace;
  font-size: 14px;
}
.single-post-content code {
  padding: 2px 6px;
}
.single-post-content pre {
  padding: 16px 20px;
  overflow-x: auto;
  margin: 1.4em 0;
}
.single-post-content pre code {
  padding: 0;
  background: transparent;
}

.single-post-content hr {
  margin: 2em 0;
  border: 0;
  border-top: 1px solid var(--color-lighter);
}

/* =============================================================================
   TABLE OF CONTENTS
   ============================================================================= */
.single-toc {
  margin: 36px 0;
  border: 1px solid var(--color-lighter);
  border-radius: var(--radius);
  background: var(--color-lightest);
  overflow: hidden;
}

/* Header bar */
.toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--color-white);
  border-bottom: 1px solid var(--color-lighter);
  gap: 12px;
}

.toc-title {
  color: var(--color-heading);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Toggle button */
.toc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  color: var(--color-midgray);
  background: var(--color-lightest);
  border: 1px solid var(--color-lighter);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
  white-space: nowrap;
}

.toc-toggle:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: var(--color-white);
}

.toc-chevron {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  stroke: currentColor;
  transition: transform 0.3s ease;
}

/* When collapsed, rotate chevron to point down */
.toc-chevron.toc-chevron-down {
  transform: rotate(180deg);
}

/* List container — animated height */
.toc-list {
  overflow: hidden;
  max-height: 2000px; /* large enough; will be overridden by JS */
  transition: max-height 0.35s ease;
}

.toc-ol {
  margin: 0;
  padding: 16px 20px;
  list-style: none;
  counter-reset: toc-item;
}

.toc-item {
  display: block;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-increment: toc-item;
}

.toc-item::marker {
  content: none;
}

.toc-link {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 0;
  color: var(--color-body, #65676b);
  font-size: 14px;
  line-height: 1.5;
  text-decoration: none;
  transition: color 0.2s ease;
  border-bottom: 1px solid transparent;
}

.toc-link:hover {
  color: var(--color-primary);
}

.toc-number {
  flex: 0 0 auto;
  color: transparent;
  font-size: 0;
  font-weight: 700;
  min-width: 28px;
}

.toc-number::before {
  content: counter(toc-item) ".";
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 700;
}

.toc-text {
  flex: 1 1 auto;
  min-width: 0;
}

/* h3 items indented */
.toc-level-3 .toc-link {
  padding-left: 20px;
  font-size: 13px;
  color: var(--color-midgray);
}

.toc-level-3 .toc-number {
  color: transparent;
  font-weight: 600;
}

.toc-level-3 .toc-number::before {
  color: var(--color-midgray);
  font-weight: 600;
}

/* Separator between items */
.toc-item + .toc-item .toc-link {
  border-top: 1px solid var(--color-lighter);
}

/* =============================================================================
   TAGS
   ============================================================================= */
.single-post-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid var(--color-lighter);
}

.single-post-tags .tags-label {
  flex: 0 0 auto;
  color: var(--color-heading);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.single-post-tags .tagcloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.single-post-tags .tagcloud a {
  display: inline-block;
  padding: 4px 14px;
  color: var(--color-midgray);
  background: var(--color-lightest);
  border-radius: var(--radius-small, 4px);
  font-size: 13px;
  line-height: 22px;
  text-decoration: none;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

.single-post-tags .tagcloud a:hover {
  color: var(--color-white);
  background: var(--color-primary);
}

/* =============================================================================
   SHARE FOOTER BAR
   ============================================================================= */
.single-post-share-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 30px;
  padding: 18px 24px;
  background: var(--color-lightest);
  border-radius: var(--radius);
}

.single-post-share-footer .share-label {
  flex: 0 0 auto;
  color: var(--color-heading);
  font-size: 14px;
  font-weight: 700;
}

/* =============================================================================
   AUTHOR BOX  — bio + fallback + "View All Posts" link
   ============================================================================= */
.single-author-box {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  margin-top: 40px;
  padding: 30px;
  background: var(--color-lightest);
  border-radius: var(--radius);
  border: 1px solid var(--color-lighter);
}

.single-author-box .author-avatar {
  flex: 0 0 80px;
  width: 80px;
  height: 80px;
  overflow: hidden;
  border-radius: 50%;
}

.single-author-box .author-avatar a {
  display: block;
  width: 100%;
  height: 100%;
}
.single-author-box .author-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.single-author-box .author-info {
  flex: 1 1 auto;
  min-width: 0;
}

.single-author-box .author-label {
  display: block;
  margin-bottom: 4px;
  color: var(--color-secondary, #d93e40);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.single-author-box .author-name {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

.single-author-box .author-name a {
  color: var(--color-heading);
}

/* Description — real or fallback */
.single-author-box .author-bio {
  margin: 0 0 16px;
  color: var(--color-body, #65676b);
  font-size: 15px;
  line-height: 1.7;
}

/* "View All Posts" CTA */
.author-more-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: gap 0.25s ease;
}

.author-more-link:hover {
  gap: 10px;
}

.author-more-link svg {
  flex: 0 0 14px;
  stroke: currentColor;
}

/* =============================================================================
   POST NAVIGATION
   ============================================================================= */
.single-post-navigation {
  display: flex;
  align-items: stretch;
  gap: 20px;
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid var(--color-lighter);
}

.single-post-navigation .nav-item {
  flex: 1 1 50%;
  min-width: 0;
}

.single-post-navigation .nav-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  color: var(--color-heading);
  background: var(--color-lightest);
  border-radius: var(--radius);
  text-decoration: none;
  height: 100%;
  transition:
    background-color 0.3s ease,
    box-shadow 0.3s ease;
}

.single-post-navigation .nav-link:hover {
  background: var(--color-white);
  box-shadow: var(--shadow-primary);
}

.single-post-navigation .nav-link-next {
  justify-content: flex-end;
  text-align: right;
}

.single-post-navigation .nav-thumbnail {
  flex: 0 0 80px;
  width: 80px;
  height: 80px;
  overflow: hidden;
  border-radius: var(--radius);
}

.single-post-navigation .nav-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
}

.single-post-navigation .nav-content {
  flex: 1 1 auto;
  min-width: 0;
}
.single-post-navigation .nav-content.text-right {
  text-align: right;
}

.single-post-navigation .nav-direction {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: var(--color-midgray);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.single-post-navigation .nav-link-next .nav-direction {
  justify-content: flex-end;
}

.single-post-navigation .nav-direction svg {
  width: 14px;
  height: 14px;
}

.single-post-navigation .nav-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--color-heading);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

/* =============================================================================
   STICKY SIDEBAR
   The outer .single-sidebar (col-lg-4) stays in normal flow.
   The inner .single-sidebar-sticky is the sticky container.
   Top offset = header height (~80px) + breathing room.
   ============================================================================= */
.single-sidebar-sticky {
  position: sticky;
  top: 90px; /* adjust if header height changes */
  max-height: none;
  overflow: visible;
  scrollbar-width: none;
  padding-right: 0;
}

.single-sidebar-sticky::-webkit-scrollbar {
  display: none;
}

/* =============================================================================
   SINGLE LAYOUT MODES
   ============================================================================= */
.single-layout-full .single-main-column {
  flex: 0 0 100%;
  max-width: 100%;
}

.single-layout-full .single-post-article {
  max-width: 980px;
  margin: 0 auto;
}

.single-layout-full .single-post-title {
  font-size: 42px;
}

.single-layout-full .single-post-content {
  font-size: 17px;
  line-height: 1.82;
}

.single-layout-full .single-post-thumbnail {
  aspect-ratio: 16 / 8.6;
}

/* =============================================================================
   RELATED POSTS — full-width 4-col section
   ============================================================================= */
.single-related-section {
  padding-left: 15px;
  padding-right: 15px;
}

.single-related-section .container {
  width: 100%;
  max-width: 1230px;
  margin: 0 auto;
  padding: 0 15px;
}

/* 4-column grid (desktop default) */
.related-posts-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 30px;
}

/* Card — reuses .content-block.image-rounded */
.related-post-card .post-thumbnail {
  overflow: hidden;
  border-radius: var(--radius);
  aspect-ratio: 390 / 260;
}

.related-post-card .post-thumbnail a {
  display: block;
  height: 100%;
}

.related-post-card .post-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
  transition: transform 0.5s ease;
}

.related-post-card:hover .post-thumbnail img {
  transform: scale(1.08);
}

.related-post-card .post-content .title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.related-post-card .post-content .title a {
  color: var(--color-heading);
}

.related-post-card .post-meta-list li {
  color: #666;
  font-size: 12px;
  line-height: 1.3;
}

/* =============================================================================
   COMMENTS
   ============================================================================= */
.single-post-comments {
  padding-top: 40px;
  border-top: 1px solid var(--color-lighter);
}

.single-post-comments .comment-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.single-post-comments .comment-body {
  padding: 20px 0;
  border-bottom: 1px solid var(--color-lighter);
}
.single-post-comments .comment-author img {
  border-radius: 50%;
}

.single-post-comments .comment-respond {
  margin-top: 30px;
}
.single-post-comments .comment-reply-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--color-heading);
}
.single-post-comments .comment-form p {
  margin-bottom: 16px;
}

.single-post-comments .comment-form input[type="text"],
.single-post-comments .comment-form input[type="email"],
.single-post-comments .comment-form input[type="url"],
.single-post-comments .comment-form textarea {
  width: 100%;
  padding: 10px 14px;
  color: var(--color-gray);
  background: var(--color-lightest);
  border: 1px solid var(--color-lighter);
  border-radius: var(--radius);
  font-size: 15px;
  line-height: 1.5;
  font-family: inherit;
  outline: none;
  transition: border-color 0.3s ease;
}

.single-post-comments .comment-form input:focus,
.single-post-comments .comment-form textarea:focus {
  border-color: var(--color-primary);
}

.single-post-comments .comment-form textarea {
  min-height: 120px;
  resize: vertical;
}

.single-post-comments .comment-form .submit {
  display: inline-block;
  padding: 10px 30px;
  color: var(--color-white);
  background: var(--color-primary);
  border: 2px solid transparent;
  border-radius: 500px;
  font-size: var(--font-size-b2);
  font-weight: var(--p-medium);
  font-family: inherit;
  cursor: pointer;
  transition:
    background-color 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease;
}

.single-post-comments .comment-form .submit:hover {
  color: var(--color-primary);
  background: transparent;
  border-color: var(--color-primary);
}

/* =============================================================================
   UTILITY
   ============================================================================= */
.mt--10 {
  margin-top: 10px;
}
.mt--20 {
  margin-top: 20px;
}
.mt--30 {
  margin-top: 30px;
}
.mt--40 {
  margin-top: 40px;
}
.mb--15 {
  margin-bottom: 15px;
}
.mb--30 {
  margin-bottom: 30px;
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

/* ── Desktop SM: 1200–1599px ────────────────────────────── */
@media only screen and (min-width: 1200px) and (max-width: 1599px) {
  .single-post-title {
    font-size: 34px;
  }

  .single-layout-full .single-post-article {
    max-width: 940px;
  }

  .single-layout-full .single-post-title {
    font-size: 38px;
  }

  .single-sidebar-sticky {
    top: 84px;
    max-height: none;
  }
}

/* ── Tablet: ≤ 1199px ─────────────────────────────────── */
@media only screen and (max-width: 1199px) {
  .single-post-title {
    font-size: 28px;
  }

  .single-layout-full .single-post-article {
    max-width: 860px;
  }

  .single-layout-full .single-post-title {
    font-size: 32px;
  }

  .single-layout-full .single-post-content {
    font-size: 16px;
  }

  .single-layout-full .single-post-thumbnail {
    aspect-ratio: 16 / 9;
  }

  /* Sidebar stops being sticky below 1200px — sidebar goes below content */
  .single-sidebar-sticky {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .single-post-meta.post-meta-wrapper {
    flex-wrap: wrap;
    gap: 12px;
  }

  .single-post-meta .social-share-transparent.justify-content-end {
    margin-left: 0;
    justify-content: flex-start;
  }

  /* Related: 2 cols on tablet */
  .related-posts-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }

  .single-author-box {
    gap: 18px;
    padding: 24px;
  }

  .single-related-section {
    padding-left: 0;
    padding-right: 0;
  }
}

/* ── Mobile: ≤ 767px ──────────────────────────────────── */
@media only screen and (max-width: 767px) {
  .single-post-thumbnail {
    border-radius: 0;
    aspect-ratio: 4 / 3;
  }

  .single-post-title {
    font-size: 22px;
    line-height: 1.32;
  }

  .single-post-meta.post-meta-wrapper {
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 14px;
  }

  .single-post-meta .post-meta-list {
    flex-wrap: wrap;
    white-space: normal;
  }
  .single-post-meta .post-meta-list li {
    white-space: normal;
  }
  .single-post-meta .social-share-transparent.justify-content-end {
    margin-left: 0;
    justify-content: flex-start;
  }

  .single-layout-full .single-post-article {
    max-width: 100%;
  }

  .single-layout-full .single-post-title {
    font-size: 24px;
  }

  .single-layout-full .single-post-content {
    font-size: 15px;
    line-height: 1.75;
  }

  .single-layout-full .single-post-thumbnail {
    aspect-ratio: 16 / 9;
  }

  .single-post-content {
    font-size: 15px;
    line-height: 1.75;
  }
  .single-post-content h2 {
    font-size: 21px;
  }
  .single-post-content h3 {
    font-size: 18px;
  }
  .single-post-content h4 {
    font-size: 16px;
  }
  .single-post-content blockquote {
    padding: 14px 18px;
    font-size: 16px;
  }

  /* TOC */
  .toc-title {
    font-size: 14px;
  }

  .single-post-share-footer {
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 16px;
  }

  .single-author-box {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
  }

  .single-post-navigation {
    flex-direction: column;
    gap: 12px;
  }
  .single-post-navigation .nav-item {
    flex: none;
    width: 100%;
  }
  .single-post-navigation .nav-link,
  .single-post-navigation .nav-link-next {
    text-align: left;
    justify-content: flex-start;
  }
  .single-post-navigation .nav-link-next .nav-direction {
    justify-content: flex-start;
  }

  /* Related: 1 col on mobile */
  .related-posts-grid-4 {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .single-post-tags {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* ── Mobile XS: ≤ 575px ────────────────────────────────── */
@media only screen and (max-width: 575px) {
  .single-layout-full .single-post-title {
    font-size: 22px;
  }

  .single-post-title {
    font-size: 19px;
  }

  .single-author-box .author-avatar {
    flex: 0 0 60px;
    width: 60px;
    height: 60px;
  }

  .single-post-navigation .nav-thumbnail {
    flex: 0 0 60px;
    width: 60px;
    height: 60px;
  }

  .single-post-navigation .nav-link {
    padding: 14px;
    gap: 12px;
  }
  .single-post-share-footer {
    padding: 14px;
  }
  .toc-header {
    padding: 12px 16px;
  }
  .toc-ol {
    padding: 12px 16px;
  }

  .single-related-section .container {
    padding: 0 12px;
  }
}

/* ================================================================
   SIDEBAR RECENT POSTS — LANDSCAPE FIX
   Override: 1:1 square → 4:3 landscape cho .post-medium thumbnail.
   Áp dụng cho: archive.php, single.php, page.php, page-contact.php
   (tất cả đều dùng .archive-sidebar từ archive.css).
   Scoped hoàn toàn trong .archive-sidebar.
   ================================================================ */

.archive-sidebar .content-block.post-medium .post-thumbnail {
  height: auto; /* bỏ height: 100px cứng */
  aspect-ratio: 4 / 3; /* 100px wide → ~75px tall, landscape */
}

/* Mobile ≤ 767px — width: 80px → ~60px tall, vẫn landscape */
@media only screen and (max-width: 767px) {
  .archive-sidebar .content-block.post-medium .post-thumbnail {
    height: auto;
    aspect-ratio: 4 / 3;
  }
}

/* Mobile XS ≤ 575px — width: 70px → ~52px tall, vẫn landscape */
@media only screen and (max-width: 575px) {
  .archive-sidebar .content-block.post-medium .post-thumbnail {
    height: auto;
    aspect-ratio: 4 / 3;
  }
}
