/* Readers' Top 3 (TopPicksController): the Readers' Favourites on the blog and
   /blog/top-3, the box on each post, members' Top 3 pages and the card mark.
   Loaded after blog.css; dark rules follow the blog's own theme switch. */

/* ---- Hero ---- */
.tp-hero {
  margin: 0.5rem 0 1.25rem;
  padding: 1.75rem 2rem;
  border-radius: 1.25rem;
  color: #fff;
  background:
    radial-gradient(circle at 85% 15%, rgba(212, 175, 55, 0.4), transparent 45%),
    linear-gradient(135deg, var(--bb-blue-900) 0%, var(--bb-blue-700) 55%, var(--bb-sage-700) 100%);
  box-shadow: 0 18px 40px -24px rgba(30, 58, 138, 0.7);
}

.tp-hero h1 {
  margin-bottom: 0.4rem;
  color: #fff;
  font-size: clamp(1.5rem, 3.2vw, 2.2rem);
  font-weight: 800;
}

.tp-hero p {
  max-width: 44rem;
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
}

.tp-hero-member {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.tp-hero-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bb-gold-400), var(--bb-gold-600));
  color: var(--bb-blue-900);
  font-size: 1.6rem;
  font-weight: 800;
}

/* ---- Layout and panels ---- */
.tp-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 1.75rem;
  align-items: start;
}

.tp-side-col {
  display: grid;
  gap: 1.25rem;
}

.tp-panel {
  margin-bottom: 1.5rem;
}

.tp-panel > h2 {
  margin-bottom: 0.85rem;
  color: var(--bb-sage-900);
  font-size: 1.3rem;
  font-weight: 800;
}

.tp-note {
  color: #6b7280;
  font-size: 0.85rem;
}

/* ---- Ranked lists: the Favourites and a member's Top 3 ---- */
.tp-fav {
  margin: 1.75rem 0 1.25rem;
}

.tp-fav-intro {
  margin: -0.4rem 0 0.9rem;
  color: #6b7280;
  font-size: 0.85rem;
}

.tp-fav-list,
.tp-picks {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tp-fav .tp-fav-list {
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
}

.tp-fav-item,
.tp-pick {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--bb-sage-200);
  border-radius: 0.9rem;
  background: #fff;
  box-shadow: 0 8px 20px -18px rgba(44, 54, 35, 0.5);
}

.tp-fav-item[data-place="1"],
.tp-pick[data-place="1"] {
  border-color: var(--bb-gold-500);
  background: linear-gradient(135deg, #fffaf0, #fff 60%);
}

.tp-fav-place {
  flex-shrink: 0;
  width: 2rem;
  color: var(--bb-sage-300);
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

[data-place="1"] > .tp-fav-place { color: var(--bb-gold-500); }
[data-place="2"] > .tp-fav-place { color: #9ca3af; }
[data-place="3"] > .tp-fav-place { color: #b87333; }

.tp-fav-media {
  flex-shrink: 0;
  width: 3.4rem;
  height: 3.4rem;
  overflow: hidden;
  border-radius: 0.6rem;
}

.tp-fav-media .blog-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tp-fav-media .blog-cover-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
}

.tp-fav-media .blog-cover-placeholder svg {
  width: 1.4rem;
  height: 1.4rem;
}

.tp-fav-media .blog-cover-placeholder span {
  display: none;
}

.tp-fav-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.tp-fav-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--bb-sage-900);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
  text-decoration: none;
}

.tp-fav-title:hover {
  color: var(--bb-blue-700);
}

.tp-fav-by,
.tp-fav-stats {
  overflow: hidden;
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #6b7280;
}

.tp-fav-stats {
  color: var(--bb-gold-700);
  font-weight: 700;
}

.tp-pick-tools {
  display: flex;
  flex-shrink: 0;
  gap: 0.25rem;
}

.tp-pick-tools .btn {
  padding: 0.1rem 0.45rem;
  line-height: 1.3;
}

/* ---- The box on a post ---- */
.tp-box {
  margin: 2rem 0 1.5rem;
  padding: 1.25rem 1.4rem;
  border: 1px solid var(--bb-gold-400);
  border-radius: 1rem;
  background: linear-gradient(135deg, #fffaf0 0%, #fff 55%);
}

.tp-box-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.tp-box-head h2 {
  margin: 0 0 0.2rem;
  color: var(--bb-sage-900);
  font-size: 1.2rem;
  font-weight: 800;
}

.tp-box-head p {
  margin: 0;
  color: #6b7280;
  font-size: 0.85rem;
}

.tp-place-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--bb-gold-400), var(--bb-gold-500));
  color: var(--bb-blue-900);
  font-size: 0.8rem;
  font-weight: 800;
  text-decoration: none;
}

.tp-box-body {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.tp-box-count {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  color: var(--bb-sage-900);
}

.tp-ranks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tp-rank-chip {
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--bb-sage-100);
  color: var(--bb-sage-700);
  font-size: 0.78rem;
  font-weight: 700;
}

.tp-rank-chip[data-rank="1"] {
  background: var(--bb-gold-100);
  color: var(--bb-gold-700);
}

.tp-box-action {
  max-width: 24rem;
}

.tp-mine {
  color: var(--bb-gold-700);
}

.tp-replace .form-select {
  width: auto;
  max-width: 100%;
}

.tp-box-part {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--bb-sage-100);
}

.tp-box-part h3 {
  margin-bottom: 0.6rem;
  color: var(--bb-blue-700);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tp-people {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tp-people a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.65rem 0.2rem 0.2rem;
  border: 1px solid var(--bb-sage-200);
  border-radius: 999px;
  background: #fff;
  color: var(--bb-sage-900);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}

.tp-people a:hover {
  border-color: var(--bb-blue-500);
}

.tp-people .blog-avatar,
.tp-matches .blog-avatar {
  width: 1.6rem;
  height: 1.6rem;
  font-size: 0.75rem;
}

.tp-people-rank {
  color: var(--bb-gold-700);
  font-weight: 800;
}

.tp-people-more {
  align-self: center;
  color: #6b7280;
  font-size: 0.82rem;
}

.tp-also {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tp-also a {
  color: var(--bb-sage-900);
  font-weight: 700;
  text-decoration: none;
}

.tp-also a:hover {
  color: var(--bb-blue-700);
}

.tp-also span {
  display: block;
  color: #6b7280;
  font-size: 0.78rem;
}

.tp-box-link,
.tp-side-link {
  display: inline-block;
  margin-top: 0.9rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
}

/* ---- Side cards: yours, readers like you, your posts ---- */
.tp-side-list {
  margin: 0;
  padding-left: 1.2rem;
}

.tp-side-list li {
  padding: 0.2rem 0;
}

.tp-side-list a {
  color: var(--bb-sage-900);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.tp-side .tp-side-link {
  margin-top: 0.6rem;
}

.tp-side p {
  margin-bottom: 0;
  font-size: 0.88rem;
}

.tp-panel-side .tp-pick {
  padding: 0.55rem 0.6rem;
  gap: 0.55rem;
}

.tp-panel-side .tp-fav-place {
  width: 1.4rem;
  font-size: 1.25rem;
}

.tp-panel-side .tp-fav-media {
  width: 2.6rem;
  height: 2.6rem;
}

.tp-matches,
.tp-on-mine {
  display: grid;
  gap: 0.7rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tp-matches a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--bb-sage-900);
  font-weight: 700;
  text-decoration: none;
}

.tp-matches-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tp-matches small,
.tp-on-mine small {
  display: block;
  color: #6b7280;
  font-size: 0.75rem;
}

.tp-matches small {
  margin-left: 2.1rem;
}

.tp-match-pill {
  flex-shrink: 0;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: var(--bb-gold-100);
  color: var(--bb-gold-700);
  font-size: 0.75rem;
  font-weight: 800;
}

.tp-on-mine li {
  font-size: 0.86rem;
}

.tp-on-mine li.is-new {
  padding-left: 0.6rem;
  border-left: 3px solid var(--bb-gold-500);
}

/* ---- How a member's Top 3 matches yours ---- */
.tp-match {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--bb-gold-400);
  border-radius: 1rem;
  background: linear-gradient(135deg, #fffaf0, #fff 60%);
  color: var(--bb-sage-900);
}

.tp-match.is-none {
  border-color: var(--bb-sage-200);
  background: #fff;
  color: #6b7280;
}

.tp-match-score {
  flex-shrink: 0;
  color: var(--bb-gold-600);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

/* ---- The mark on blog cards ---- */
.blog-card-fav {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--bb-gold-100);
  color: var(--bb-gold-700);
  font-size: 0.68rem;
  font-weight: 800;
}

@media (max-width: 991.98px) {
  .tp-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 575.98px) {
  .tp-hero {
    padding: 1.4rem 1.25rem;
  }

  .tp-hero-member {
    align-items: flex-start;
  }

  .tp-hero-avatar {
    width: 3rem;
    height: 3rem;
    font-size: 1.25rem;
  }

  .tp-box {
    padding: 1rem;
  }
}

/* ---- Dark (the blog's theme switch) ---- */
[data-blog-theme="dark"] .tp-fav-item,
[data-blog-theme="dark"] .tp-pick,
[data-blog-theme="dark"] .tp-people a,
[data-blog-theme="dark"] .tp-match.is-none {
  border-color: var(--blog-night-border);
  background: var(--blog-night-surface);
  box-shadow: none;
}

[data-blog-theme="dark"] .tp-fav-item[data-place="1"],
[data-blog-theme="dark"] .tp-pick[data-place="1"],
[data-blog-theme="dark"] .tp-box,
[data-blog-theme="dark"] .tp-match {
  border-color: rgba(212, 175, 55, 0.55);
  background: linear-gradient(135deg, #2a2715 0%, var(--blog-night-surface) 60%);
}

[data-blog-theme="dark"] .tp-panel > h2,
[data-blog-theme="dark"] .tp-box-head h2,
[data-blog-theme="dark"] .tp-box-count,
[data-blog-theme="dark"] .tp-fav-title,
[data-blog-theme="dark"] .tp-also a,
[data-blog-theme="dark"] .tp-people a,
[data-blog-theme="dark"] .tp-side-list a,
[data-blog-theme="dark"] .tp-matches a,
[data-blog-theme="dark"] .tp-match {
  color: var(--blog-night-heading);
}

[data-blog-theme="dark"] .tp-fav-title:hover,
[data-blog-theme="dark"] .tp-also a:hover {
  color: var(--blog-night-link);
}

[data-blog-theme="dark"] .tp-note,
[data-blog-theme="dark"] .tp-fav-intro,
[data-blog-theme="dark"] .tp-fav-by,
[data-blog-theme="dark"] .tp-box-head p,
[data-blog-theme="dark"] .tp-also span,
[data-blog-theme="dark"] .tp-people-more,
[data-blog-theme="dark"] .tp-matches small,
[data-blog-theme="dark"] .tp-on-mine small,
[data-blog-theme="dark"] .tp-match.is-none {
  color: var(--blog-night-muted);
}

[data-blog-theme="dark"] .tp-box-part {
  border-top-color: var(--blog-night-border);
}

[data-blog-theme="dark"] .tp-box-part h3 {
  color: var(--blog-night-link);
}

[data-blog-theme="dark"] .tp-rank-chip {
  background: var(--blog-night-raised);
  color: var(--blog-night-text);
}

[data-blog-theme="dark"] .tp-rank-chip[data-rank="1"],
[data-blog-theme="dark"] .tp-match-pill,
[data-blog-theme="dark"] .blog-card-fav {
  background: rgba(212, 175, 55, 0.18);
  color: #f0d27a;
}

[data-blog-theme="dark"] .tp-fav-stats,
[data-blog-theme="dark"] .tp-mine,
[data-blog-theme="dark"] .tp-people-rank,
[data-blog-theme="dark"] .tp-match-score {
  color: #e3c15c;
}
