/* ==========================================================================
   blog-post.css — single blog article page
   Two columns: long article (left) + sticky sidebar (right, sticks on scroll).
   Self-contained, includes its own responsive rules.
   ========================================================================== */

.tp-post {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

/* ---- Breadcrumb ---- */
.tp-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  color: var(--tp-muted);
}

.tp-breadcrumb a {
  color: var(--tp-muted);
  transition: color 0.15s ease;
}

.tp-breadcrumb a:hover { color: var(--tp-green); }

.tp-breadcrumb .sep { color: #c2c8c4; }

.tp-breadcrumb .current { color: var(--tp-text); font-weight: 500; }

/* ---- Article head ---- */
.tp-post__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tp-post__save {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--tp-text);
  background: var(--tp-white);
  border: 1px solid var(--tp-border);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.tp-post__save:hover { border-color: var(--tp-green); color: var(--tp-green); }
.tp-post__save img { width: 16px; height: 16px; }

.tp-post__save.is-saved {
  color: var(--tp-green);
  border-color: var(--tp-green);
  background: #eef6f0;
}

/* ---- Toast (share/save feedback) ---- */
.tp-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  z-index: 1090;
  padding: 0.7rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: #fff;
  background: #111827;
  border-radius: 0.55rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.tp-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.tp-post__title {
  margin: 0 0 0.8rem;
  font-size: clamp(1.8rem, 3.6vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--tp-text);
}

.tp-post__excerpt {
  margin: 0 0 1.5rem;
  font-size: 1.1rem;
  color: var(--tp-muted);
  max-width: 42em;
}

/* ---- Meta row ---- */
.tp-post__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--tp-border);
}

.tp-post__author {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.tp-post__author img {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: cover;
}

.tp-post__author b {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--tp-text);
}

.tp-post__author span {
  font-size: 0.8rem;
  color: var(--tp-muted);
}

.tp-post__meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--tp-muted);
}

.tp-post__meta-item img { width: 16px; height: 16px; }

.tp-post__share {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.tp-post__share .label { font-size: 0.85rem; color: var(--tp-muted); }

.tp-post__share a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e9f3ec;
  transition: background 0.15s ease, transform 0.15s ease;
}

.tp-post__share a:hover { background: #d2e9da; transform: translateY(-2px); }
.tp-post__share img { width: 16px; height: 16px; }

/* ---- Featured image ---- */
.tp-post__hero {
  margin-bottom: 1.75rem;
  border-radius: 0.85rem;
  overflow: hidden;
  aspect-ratio: 16 / 8;
}

.tp-post__hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---- Article body ---- */
.tp-post__body p {
  margin: 0 0 1.2rem;
  font-size: 1rem;
  line-height: 1.8;
  color: #374151;
}

.tp-post__body h2 {
  margin: 2rem 0 0.9rem;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--tp-text);
}

/* ---- Rich content from CKEditor (images + tables) ---- */
.tp-post__body img {
  display: block;
  width: 100%;
  height: auto;
  margin: 1.5rem 0;
  border-radius: 0.65rem;
}

/* horizontal-scroll wrapper added around tables by JS */
.tp-table-scroll {
  width: 100%;
  margin: 1.6rem 0;
  overflow-x: auto;
  border: 1px solid var(--tp-border);
  border-radius: 0.7rem;
  -webkit-overflow-scrolling: touch;
}

.tp-post__body table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.tp-table-scroll table { min-width: 480px; }

.tp-post__body thead th {
  background: var(--tp-green);
  color: #fff;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.tp-post__body th,
.tp-post__body td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--tp-border);
  vertical-align: top;
  color: #374151;
}

.tp-post__body tbody tr:nth-child(even) { background: #f7faf8; }
.tp-post__body tbody tr:hover { background: #eef6f0; }
.tp-post__body tbody tr:last-child td { border-bottom: 0; }

/* ---- Table of contents ---- */
.tp-toc {
  margin: 1.75rem 0;
  padding: 1.4rem 1.6rem;
  border: 1px solid var(--tp-border);
  border-radius: 0.85rem;
  background: #fafbfa;
}

.tp-toc__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.tp-toc__head h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--tp-text);
}

.tp-toc__icon {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 0.45rem;
  background: #e3f1e8;
}

.tp-toc__icon img { width: 18px; height: 18px; }

.tp-toc__list {
  list-style: none;
  counter-reset: toc;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem 2rem;
}

.tp-toc__list li {
  counter-increment: toc;
  display: flex;
  gap: 0.5rem;
  font-size: 0.92rem;
  color: #374151;
}

.tp-toc__list li::before {
  content: counter(toc) ".";
  color: var(--tp-green);
  font-weight: 600;
}

.tp-toc__list a { color: #374151; transition: color 0.15s ease; }
.tp-toc__list a:hover { color: var(--tp-green); }

/* ==========================================================================
   Sidebar (sticky)
   ========================================================================== */
.tp-post__sidebar {
  position: sticky;
  top: 90px;            /* clears the sticky header */
  display: grid;
  gap: 1.5rem;
  align-self: start;     /* required so sticky works inside a flex/grid row */
}

.tp-side-card {
  padding: 1.5rem;
  border: 1px solid var(--tp-border);
  border-radius: 0.85rem;
  background: var(--tp-white);
}

/* ---- Search Articles (sidebar) ---- */
.tp-side-search {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--tp-border);
  border-radius: 0.7rem;
  overflow: hidden;
  background: var(--tp-white);
}

.tp-side-search input {
  flex: 1 1 auto;
  min-width: 0;
  height: 36px;
  border: 0;
  outline: none;
  padding: 0 0.8rem;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--tp-text);
}

.tp-side-search input::placeholder { color: #9ca3af; }

.tp-side-search button {
  flex: 0 0 auto;
  width: 38px;
  height: 36px;
  border: 0;
  background-image: var(--tp-green-gradient);
  cursor: pointer;
  transition: background-image 0.15s ease;
}

.tp-side-search button:hover { background-image: var(--tp-green-gradient-hover); }
.tp-side-search button img { width: 18px; height: 18px; }

/* ---- Ad slot (just the creative image + AD badge) ---- */
.tp-ad {
  position: relative;
  border: 1px solid var(--tp-border);
  border-radius: 0.85rem;
  overflow: hidden;
  line-height: 0;
}

.tp-ad__img {
  display: block;
  width: 100%;
  height: auto;
}

.tp-ad__badge {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  z-index: 1;
  padding: 0.12rem 0.5rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.4;
  color: #6b7280;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 0.35rem;
}

.tp-side-card__title {
  margin: 0 0 1.2rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--tp-text);
  position: relative;
  padding-bottom: 0.6rem;
}

.tp-side-card__title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 34px;
  height: 3px;
  border-radius: 3px;
  background: var(--tp-green);
}

/* author card — photo left, name + role right */
.tp-author__head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.tp-author__photo {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  min-width: 72px;
  max-width: 72px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: cover;
}

.tp-author__name {
  display: block;
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--tp-text);
  transition: color 0.15s ease;
}

.tp-author__name:hover { color: var(--tp-green); }

.tp-author__role {
  display: block;
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--tp-green);
}

.tp-author__bio {
  margin: 0 0 1.1rem;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--tp-muted);
}

.tp-author__social {
  display: flex;
  gap: 0.5rem;
}

.tp-author__social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--tp-border);
  border-radius: 0.5rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.tp-author__social a:hover { background: #e9f3ec; border-color: var(--tp-green); }
.tp-author__social img { width: 16px; height: 16px; }

/* related articles — full-width image + title */
.tp-related {
  display: grid;
  gap: 1.4rem;
}

.tp-related__item {
  display: block;
}

.tp-related__thumb {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 0.65rem;
  margin-bottom: 0.6rem;
  transition: transform 0.25s ease;
}

.tp-related__item:hover .tp-related__thumb {
  transform: scale(1.02);
}

.tp-related__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--tp-text);
  transition: color 0.15s ease;
  /* clamp to 2 lines so titles stay tidy */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tp-related__item:hover .tp-related__title { color: var(--tp-green); }

/* ---- Promo card (Save Time / Explore Tools) ---- */
.tp-side-promo {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, #f1f8f3 0%, #e4f1e9 100%);
  border-color: #d8eadf;
}

/* subtle decorative circles */
.tp-side-promo::before {
  content: "";
  position: absolute;
  top: -45px;
  right: -45px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(9, 119, 54, 0.13), transparent 70%);
}

.tp-side-promo::after {
  content: "";
  position: absolute;
  bottom: -40px;
  left: -40px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(9, 119, 54, 0.08), transparent 70%);
}

.tp-side-promo__content {
  position: relative;
  z-index: 1;
}

/* icon badge */
.tp-side-promo__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  border-radius: 0.8rem;
  background-image: var(--tp-green-gradient);
  box-shadow: 0 6px 16px rgba(9, 119, 54, 0.25);
}

.tp-side-promo__badge img { width: 26px; height: 26px; }

.tp-side-promo__title {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--tp-text);
}

.tp-side-promo__text {
  margin: 0 0 1.2rem;
  font-size: 0.88rem;
  color: var(--tp-muted);
}

/* full-width button */
.tp-side-promo__btn {
  width: 100%;
}

/* ---- Categories card ---- */
.tp-cat-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tp-cat-list li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--tp-border);
  font-size: 0.92rem;
  color: var(--tp-text);
  transition: color 0.15s ease, padding-left 0.15s ease;
}

.tp-cat-list li:last-child a { border-bottom: 0; }

.tp-cat-list li a:hover {
  color: var(--tp-green);
  padding-left: 3px;
}

.tp-cat-count {
  flex: 0 0 auto;
  min-width: 30px;
  padding: 0.15rem 0.55rem;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--tp-green);
  background: #e3f1e8;
  border-radius: 999px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 767.98px) {
  .tp-post__sidebar {
    position: static;
    top: auto;
    margin-top: 2.5rem;
  }
}

@media (max-width: 575.98px) {
  .tp-post__share { margin-left: 0; width: 100%; }
  .tp-toc__list { grid-template-columns: 1fr; }
  .tp-post__excerpt { font-size: 1rem; }
}
