/* Blog - cards & hero (site idiom) + light theme for rich markdown content.
   Layout/overflow rules for .article-content come from chat-rich-content.css
   (specificity-0 :where() selectors); this file only overrides the THEME. */

/* ── Blog list : featured article ── */
.blog-featured-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(var(--primary-rgb), 0.14);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.blog-featured-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.blog-featured-cover {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 1;
  object-fit: cover;
  background: var(--primary-gradient);
}

.blog-featured-cover-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 2 / 1;
  background: var(--primary-gradient);
  color: rgba(255, 255, 255, 0.85);
  font-size: 3.5rem;
}

.blog-featured-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--spacing-lg, 2rem);
}

/* ── Blog list : full-viewport featured hero ──
   The first screen is entirely devoted to the featured article so the card
   is fully visible without scrolling. Height uses svh (stable small viewport)
   so mobile browser chrome never crops the card. */
.blog-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(74px + clamp(0.75rem, 2.5vh, 1.75rem)) 0 clamp(0.75rem, 2vh, 1.5rem);
  overflow: hidden;
}

.blog-hero-inner {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: clamp(0.75rem, 2.5vh, 1.75rem);
}

.blog-hero-header {
  flex: 0 0 auto;
}

.blog-hero-title {
  margin: clamp(0.35rem, 1vh, 0.75rem) 0 0;
  font-size: clamp(1.35rem, 1.05rem + 2.2vw, 2.6rem);
  line-height: 1.15;
  text-wrap: balance;
}

.blog-hero-intro {
  max-width: 720px;
  margin: clamp(0.35rem, 1vh, 0.65rem) auto 0;
  font-size: clamp(0.82rem, 0.75rem + 0.35vw, 1rem);
  color: var(--text-muted);
}

.blog-hero-card {
  display: grid;
  grid-template-rows: minmax(0, 0.42fr) minmax(0, 0.58fr);
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}

.blog-hero-media {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.blog-hero-card .blog-featured-cover,
.blog-hero-card .blog-featured-cover-placeholder {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  object-fit: cover;
}

.blog-hero-body {
  min-height: 0;
  overflow: hidden;
  justify-content: center;
  padding: clamp(1rem, 2.5vh, 2rem) clamp(1.1rem, 2.5vw, 2.4rem);
}

.blog-hero-card .blog-category-badge,
.blog-hero-card .blog-draft-badge {
  margin-bottom: clamp(0.4rem, 1vh, 0.75rem);
}

.blog-hero-title-card {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: clamp(0.4rem, 1vh, 0.75rem);
  font-size: clamp(1.15rem, 1rem + 0.9vw, 1.9rem);
}

.blog-hero-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 0 1 auto;
  margin-bottom: clamp(0.4rem, 1.2vh, 0.9rem);
}

.blog-hero-meta {
  margin-bottom: clamp(0.6rem, 1.6vh, 1.1rem);
}

.blog-hero-cta {
  flex: 0 0 auto;
}

/* Landscape: split the card so cover and text share the full width. */
@media (min-width: 768px) {
  .blog-hero-card {
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }

  .blog-hero-excerpt {
    -webkit-line-clamp: 5;
  }
}

/* Keep the card whole on short or narrow viewports. */
@media (max-width: 767.98px) {
  .blog-hero-card {
    grid-template-rows: minmax(0, 0.38fr) minmax(0, 0.62fr);
  }

  .blog-hero-title-card {
    -webkit-line-clamp: 2;
  }

  .blog-hero-excerpt {
    -webkit-line-clamp: 2;
  }
}

@media (max-height: 680px) {
  .blog-hero-intro {
    display: none;
  }

  .blog-hero-excerpt {
    -webkit-line-clamp: 2;
  }
}

@media (max-height: 560px) {
  .blog-hero .blog-hero-excerpt {
    display: none;
  }

  .blog-hero-title {
    font-size: clamp(1.1rem, 1rem + 1.4vw, 1.6rem);
  }
}

.blog-archive {
  padding-top: clamp(2rem, 5vh, 4rem);
}

/* ── Blog list : article cards ── */
.blog-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(var(--primary-rgb), 0.14);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.blog-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.blog-card-cover {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--primary-gradient);
}

.blog-card-cover-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--primary-gradient);
  color: rgba(255, 255, 255, 0.85);
  font-size: 2.25rem;
}

.blog-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--spacing-md, 1.5rem);
}

.blog-card-title {
  font-size: var(--font-size-lg, 1.25rem);
  font-weight: 700;
  color: var(--text-emphasis);
  line-height: 1.3;
}

.blog-card-title a {
  color: inherit;
  text-decoration: none;
}

.blog-card-title a:hover {
  color: var(--primary-dark);
}

.blog-card-excerpt {
  color: var(--text-muted);
  font-size: var(--font-size-sm, 0.9rem);
  flex: 1;
}

.blog-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  align-self: flex-start;
  padding: 0.25rem 0.75rem;
  margin-bottom: 0.75rem;
  font-size: var(--font-size-xs, 0.75rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary-dark);
  background: var(--primary-light);
  border-radius: var(--border-radius-pill);
}

/* Draft badge: visible to staff/admin only (template-gated) */
.blog-draft-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  align-self: flex-start;
  padding: 0.25rem 0.75rem;
  margin-bottom: 0.75rem;
  margin-left: 0.5rem;
  font-size: var(--font-size-xs, 0.75rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #9a6b00;
  background: #fdf3e0;
  border: 1px solid rgba(217, 145, 22, 0.45);
  border-radius: var(--border-radius-pill);
}

.blog-card-meta,
.blog-article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  color: var(--text-muted);
  font-size: var(--font-size-xs, 0.8rem);
}

.blog-card-meta i,
.blog-article-meta i {
  margin-right: 0.3rem;
  color: var(--primary-color);
}

/* ── Blog list : pagination ── */
.blog-pagination .page-link {
  min-width: 2.5rem;
  padding: 0.5rem 0.75rem;
  text-align: center;
  font-weight: 600;
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(var(--primary-rgb), 0.2);
  border-radius: var(--border-radius-md);
}

.blog-pagination .page-link:hover {
  color: var(--primary-dark);
  background: var(--primary-light);
  border-color: var(--primary-color);
}

.blog-pagination .page-item.active .page-link {
  color: #fff;
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.blog-pagination .page-item.disabled .page-link {
  color: var(--text-muted);
  background: transparent;
  border-color: rgba(var(--primary-rgb), 0.12);
  opacity: 0.6;
}

/* ── Article detail ── */
.blog-article-header {
  padding: calc(var(--spacing-xl, 5rem) + 2rem) 0 var(--spacing-md, 1.5rem);
  background: linear-gradient(180deg, var(--primary-light) 0%, var(--page-bg) 100%);
}

.blog-article-title {
  font-size: var(--font-size-3xl, 2.5rem);
  font-weight: 800;
  color: var(--text-emphasis);
  line-height: 1.15;
  text-wrap: balance;
}

.blog-article-cover {
  width: 100%;
  max-height: 460px;
  object-fit: cover;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
}

.blog-breadcrumb {
  font-size: var(--font-size-sm, 0.875rem);
}

.blog-breadcrumb a {
  color: var(--primary-dark);
  text-decoration: none;
}

.blog-breadcrumb a:hover {
  text-decoration: underline;
}

/* Rich markdown content theme lives in web/css/article-content.css (shared
   with the wiki app); this file keeps only the blog-specific styles. */

@media (max-width: 575.98px) {
  .blog-article-title {
    font-size: var(--font-size-2xl, 1.9rem);
  }
}
