/* ==========================================================================
   Public blog: list, cards, article typography, pagination.
   Tokens (--brand-*, --ink, --muted, --radius, --shadow-*) come from app.css.
   ========================================================================== */

/* ---------- Hero (blog list) ---------- */
.blog-hero {
  position: relative;
  overflow: hidden;
  padding: 3.2rem 0 4.4rem;
  color: #fff;
  background:
    radial-gradient(circle at 10% 15%, rgba(255, 255, 255, .10) 0, transparent 40%),
    radial-gradient(circle at 92% 0%, rgba(200, 149, 44, .30) 0, transparent 45%),
    linear-gradient(135deg, var(--brand-green) 0%, var(--brand-green-dark) 100%);
}

.blog-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cpath d='M36 6l7 14 15-7-7 15 14 7-14 7 7 15-15-7-7 14-7-14-15 7 7-15-14-7 14-7-7-15 15 7z' fill='none' stroke='%23ffffff' stroke-opacity='.07' stroke-width='1'/%3E%3C/svg%3E");
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 90%);
  mask-image: linear-gradient(180deg, #000 0%, transparent 90%);
}

.blog-hero .container { position: relative; }
.blog-hero h1 { font-size: clamp(2rem, 4vw, 2.9rem); font-weight: 800; letter-spacing: -.025em; }
.blog-hero p { max-width: 38rem; margin-inline: auto; color: rgba(255, 255, 255, .86); }

.blog-search {
  position: relative;
  max-width: 30rem;
  margin: 1.6rem auto 0;
}

.blog-search i {
  position: absolute;
  top: 50%;
  left: 1.1rem;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.blog-search input {
  width: 100%;
  height: 3.1rem;
  padding: 0 7.2rem 0 2.8rem;
  border: 0;
  border-radius: 2rem;
  background: #fff;
  color: var(--ink);
  font-size: .95rem;
  box-shadow: 0 14px 28px -16px rgba(0, 0, 0, .55);
}

.blog-search input:focus { outline: 3px solid rgba(241, 199, 104, .8); outline-offset: 2px; }

.blog-search button {
  position: absolute;
  top: .3rem;
  right: .3rem;
  bottom: .3rem;
  padding: 0 1.2rem;
  border: 0;
  border-radius: 2rem;
  background: var(--brand-green);
  color: #fff;
  font-weight: 700;
  font-size: .88rem;
}

.blog-search button:hover { background: var(--brand-green-dark); }

.blog-body { margin-top: -2.2rem; position: relative; z-index: 2; }

/* ---------- Cards ---------- */
.post-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid #e8efec;
  border-radius: var(--radius);
  background: #fff;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.post-card:hover,
.post-card:focus-within {
  transform: translateY(-4px);
  border-color: rgba(15, 110, 79, .35);
  box-shadow: var(--shadow-md);
}

.post-card-media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--brand-green-light);
}

.post-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}

.post-card:hover .post-card-media img { transform: scale(1.04); }

.post-card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: rgba(255, 255, 255, .85);
  font-size: 2.6rem;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cpath d='M36 6l7 14 15-7-7 15 14 7-14 7 7 15-15-7-7 14-7-14-15 7 7-15-14-7 14-7-7-15 15 7z' fill='none' stroke='%23ffffff' stroke-opacity='.10'/%3E%3C/svg%3E"),
    radial-gradient(circle at 85% 10%, rgba(200, 149, 44, .35) 0, transparent 50%),
    linear-gradient(135deg, var(--brand-green) 0%, var(--brand-green-dark) 100%);
}

.post-card-body { min-width: 0; display: flex; flex: 1; flex-direction: column; padding: 1.2rem 1.3rem 1.1rem; }

.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin-bottom: .6rem; font-size: .78rem; color: var(--muted); }

.post-badge {
  max-width: 100%;
  padding: .15rem .6rem;
  overflow: hidden;
  border-radius: 2rem;
  background: var(--brand-green-light);
  color: var(--brand-green-dark);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-card-title { margin: 0 0 .5rem; font-size: 1.12rem; font-weight: 800; line-height: 1.35; letter-spacing: -.01em; }
.post-card-title a { color: var(--ink); text-decoration: none; }
.post-card-title a:hover { color: var(--brand-green); }
/* The whole card is clickable (the image link is hidden from assistive tech, the title link is the real one). */
.post-card-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.post-card { position: relative; }
.post-card-foot a { position: relative; z-index: 2; }

.post-card-summary { margin: 0 0 1rem; font-size: .9rem; line-height: 1.6; color: var(--muted); }

.post-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-top: auto;
  padding-top: .85rem;
  border-top: 1px solid #eef3f1;
  font-size: .8rem;
  color: var(--muted);
}

.post-more { font-weight: 700; color: var(--brand-green); text-decoration: none; }
.post-more i { transition: transform .18s ease; }
.post-card:hover .post-more i { transform: translateX(4px); }

/* Featured: large, side by side on wide screens */
@media (min-width: 992px) {
  .post-card.is-featured { flex-direction: row; }
  .post-card.is-featured .post-card-media { flex: 0 0 52%; aspect-ratio: auto; min-height: 20rem; }
  .post-card.is-featured .post-card-body { padding: 2rem 2.2rem; justify-content: center; }
  .post-card.is-featured .post-card-title { font-size: 1.7rem; }
  .post-card.is-featured .post-card-summary { font-size: 1rem; }
}

.post-card.is-featured .post-card-label {
  display: inline-block;
  margin-bottom: .6rem;
  color: var(--brand-gold);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* ---------- Pagination ---------- */
.blog-pager { margin-top: 2.6rem; }

.blog-pager ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.blog-pager a,
.blog-pager li > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  min-width: 2.6rem;
  height: 2.6rem;
  padding: 0 .9rem;
  border: 1px solid #dfe9e5;
  border-radius: .75rem;
  background: #fff;
  color: var(--ink);
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

.blog-pager a:hover { border-color: var(--brand-green); background: var(--brand-green-light); color: var(--brand-green-dark); }
.blog-pager .is-active > span { border-color: var(--brand-green); background: var(--brand-green); color: #fff; }
.blog-pager .is-disabled > span { color: #aab8b3; background: #f6f9f8; }
.blog-pager .is-gap > span { border-color: transparent; background: transparent; min-width: 1.6rem; padding: 0; }

.blog-count { margin-top: 1rem; text-align: center; font-size: .85rem; color: var(--muted); }

/* ---------- Empty state ---------- */
.blog-empty {
  padding: 3.2rem 1.5rem;
  border: 2px dashed #cfe0d9;
  border-radius: var(--radius);
  background: #fff;
  text-align: center;
  color: var(--muted);
}

.blog-empty i { display: block; margin-bottom: .6rem; font-size: 2.6rem; color: #b7c7c2; }

/* ---------- Article page ---------- */
.article-wrap { max-width: 46rem; margin-inline: auto; }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: 0 0 1.1rem; padding: 0; list-style: none; font-size: .82rem; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--brand-green); text-decoration: underline; }
.crumbs li + li::before { content: "/"; margin-right: .35rem; opacity: .5; }
.crumbs li[aria-current] { max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.article-title { margin: 0 0 1rem; font-size: clamp(1.8rem, 4vw, 2.7rem); font-weight: 800; line-height: 1.2; letter-spacing: -.025em; color: var(--ink); }

.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.1rem; margin-bottom: 1.6rem; font-size: .88rem; color: var(--muted); }
.article-meta .who { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; color: var(--ink); }

.avatar-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  overflow: hidden;
  border-radius: 50%;
  background: var(--brand-green-light);
  color: var(--brand-green);
  object-fit: cover;
}

.article-cover { margin: 0 0 2rem; }
.article-cover img { width: 100%; height: auto; border-radius: var(--radius); box-shadow: var(--shadow-sm); }

.article-lead { margin: 0 0 1.6rem; padding-left: 1rem; border-left: 4px solid var(--brand-gold); font-size: 1.12rem; line-height: 1.7; color: #3b4a45; }

/* The body text the author wrote in Markdown */
.prose { font-size: 1.06rem; line-height: 1.85; color: #25332f; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose h2 { margin: 2.4rem 0 .9rem; font-size: 1.6rem; font-weight: 800; line-height: 1.3; letter-spacing: -.015em; color: var(--ink); }
.prose h3 { margin: 1.9rem 0 .7rem; font-size: 1.28rem; font-weight: 800; line-height: 1.35; color: var(--ink); }
.prose h4 { margin: 1.6rem 0 .6rem; font-size: 1.08rem; font-weight: 800; }
.prose p { margin: 0 0 1.25rem; }
.prose a { color: var(--brand-green); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.prose a:hover { color: var(--brand-green-dark); }
.prose ul, .prose ol { margin: 0 0 1.4rem; padding-left: 1.5rem; }
.prose li { margin-bottom: .45rem; }
.prose li::marker { color: var(--brand-green); font-weight: 700; }
.prose blockquote { margin: 1.6rem 0; padding: 1rem 1.3rem; border-left: 4px solid var(--brand-green); border-radius: 0 .7rem .7rem 0; background: var(--brand-green-light); color: #1f4a3b; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose img { display: block; max-width: 100%; height: auto; margin: 1.6rem auto; border-radius: .8rem; }
.prose hr { margin: 2.4rem 0; border: 0; border-top: 1px solid #dfe9e5; }
.prose code { padding: .12rem .4rem; border-radius: .35rem; background: #eef3f1; font-size: .9em; }
.prose pre { margin: 1.4rem 0; padding: 1rem 1.2rem; overflow-x: auto; border-radius: .8rem; background: #11231d; color: #e8f1ed; }
.prose pre code { padding: 0; background: transparent; color: inherit; }
.prose table { display: block; width: 100%; margin: 1.5rem 0; overflow-x: auto; border-collapse: collapse; font-size: .95rem; }
.prose th, .prose td { padding: .65rem .9rem; border: 1px solid #dfe9e5; text-align: left; }
.prose th { background: var(--brand-green-light); color: var(--brand-green-dark); }

/* Share */
.share { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 2.4rem 0 0; padding-top: 1.3rem; border-top: 1px solid #e3ebe8; }
.share-label { margin-right: .3rem; font-size: .85rem; font-weight: 700; color: var(--muted); }

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .9rem;
  border: 1px solid #dfe9e5;
  border-radius: 2rem;
  background: #fff;
  color: var(--ink);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

.share-btn:hover { border-color: var(--brand-green); background: var(--brand-green-light); color: var(--brand-green-dark); }
.share-btn.is-done { border-color: var(--brand-green); background: var(--brand-green); color: #fff; }

/* Author + call to action */
.author-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  padding: 1.2rem 1.3rem;
  border: 1px solid #e3ebe8;
  border-radius: var(--radius);
  background: #fff;
}

.author-card .avatar-lg { width: 3.4rem; height: 3.4rem; flex-shrink: 0; border-radius: .9rem; object-fit: cover; background: var(--brand-green-light); display: inline-flex; align-items: center; justify-content: center; color: var(--brand-green); font-size: 1.5rem; }

.cta-card {
  margin-top: 2rem;
  padding: 1.8rem;
  border-radius: var(--radius);
  color: #fff;
  background:
    radial-gradient(circle at 90% 0%, rgba(200, 149, 44, .35) 0, transparent 50%),
    linear-gradient(135deg, var(--brand-green) 0%, var(--brand-green-dark) 100%);
}

.cta-card h2 { margin: 0 0 .4rem; font-size: 1.35rem; font-weight: 800; }
.cta-card p { margin: 0 0 1rem; color: rgba(255, 255, 255, .86); }

.preview-banner { padding: .7rem 1rem; background: #fff3cd; color: #664d03; text-align: center; font-size: .9rem; font-weight: 600; }

@media (max-width: 575.98px) {
  .blog-hero { padding: 2.4rem 0 3.6rem; }
  .prose { font-size: 1rem; line-height: 1.8; }
  .author-card { flex-direction: column; text-align: center; }
  .crumbs li[aria-current] { max-width: 11rem; }
}

@media (prefers-reduced-motion: reduce) {
  .post-card, .post-card-media img, .post-more i, .blog-pager a, .share-btn { transition: none; }
  .post-card:hover { transform: none; }
}
