/* ============================================================================
   HINT IT — v2 design system : BLOG
   ----------------------------------------------------------------------------
   All blog surfaces: the public index (/v2/blog), the article page
   (/v2/blog/{slug}), and the admin authoring pages (/v2/admin/blog*).
   Linked per-page (from each page's <HeadContent>), not from V2Shell — the
   article.css precedent. Scoped under `.hint-v2`, token-driven.

   `.blog-prose` styles RENDERED MARKDOWN (BlogMarkdown output), which can't
   carry classes — descendant element selectors inside a scoped wrapper are the
   sanctioned pattern here (same as `.v2-article`). It is deliberately the ONE
   source of prose styling for BOTH the public article and the admin editor's
   Preview tab, so preview == published.
   ============================================================================ */

/* ── Index: hero sub-line + filter pills ── */

.hint-v2 .blog-hero-sub {
  color: var(--text-on-brand-muted);
  line-height: var(--leading-relaxed);
  margin-top: var(--space-3);
}

.hint-v2 .blog-filter { gap: var(--space-2); }
.hint-v2 .blog-filter .pill {
  text-decoration: none;
  transition: background var(--dur-hover) var(--ease-out), color var(--dur-hover) var(--ease-out);
}
.hint-v2 .blog-pill-active {
  background: var(--brand);
  color: var(--text-on-brand);
}

/* ── Index: card grid ── */

.hint-v2 .blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: var(--space-5);
}

.hint-v2 .blog-card {
  display: flex;
  flex-direction: column;
  padding: 0;                      /* media runs edge-to-edge; body re-adds the inset */
  overflow: hidden;
  text-decoration: none;
  color: var(--text-primary);
  transition: box-shadow var(--dur-hover) var(--ease-out), translate var(--dur-hover) var(--ease-out);
}
.hint-v2 .blog-card:hover {
  box-shadow: var(--shadow-card-hover);
  translate: 0 -2px;
}

.hint-v2 .blog-card-media {
  aspect-ratio: 16 / 9;
  /* Brand placeholder shows whenever there's no cover image. */
  background: linear-gradient(135deg, var(--brand), var(--purple-500));
  /* Explicit top rounding (nested 1px inside the card border) — don't rely on the
     card's overflow clip alone; it can bleed square corners during the hover lift. */
  border-radius: calc(var(--radius-card) - 1px) calc(var(--radius-card) - 1px) 0 0;
  overflow: hidden;
}
.hint-v2 .blog-card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hint-v2 .blog-card-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-5);
}
.hint-v2 .blog-card-excerpt {
  color: var(--text-secondary);
  line-height: var(--leading-normal);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hint-v2 .blog-meta {
  margin-top: auto;                /* pins author · date to the card bottom */
  font-size: var(--text-label);
  color: var(--text-muted);
}

/* ── Article page ── */

.hint-v2 .blog-post-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4);
}
.hint-v2 .blog-post-head .pill { text-decoration: none; }

.hint-v2 .blog-standfirst {
  font-size: var(--text-subhead);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

.hint-v2 .blog-byline {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-label);
  color: var(--text-muted);
}
.hint-v2 .blog-byline .avatar { flex-shrink: 0; }
.hint-v2 .blog-byline-who {
  display: flex;
  flex-direction: column;
}
.hint-v2 .blog-byline-name {
  color: var(--text-primary);
  font-weight: var(--fw-semibold);
}

.hint-v2 .blog-cover {
  display: block;
  width: 100%;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.hint-v2 .blog-more { background: var(--bg-screen); }

/* ── Rendered markdown (public article + editor preview) ── */

.hint-v2 .blog-prose {
  line-height: var(--leading-relaxed);
  color: var(--text-primary);
}
.hint-v2 .blog-prose h2 {
  font-size: var(--text-heading);
  margin: var(--space-7) 0 var(--space-3);
}
.hint-v2 .blog-prose h3 {
  font-size: var(--text-subhead);
  margin: var(--space-6) 0 var(--space-3);
}
.hint-v2 .blog-prose h2:first-child,
.hint-v2 .blog-prose h3:first-child { margin-top: 0; }
.hint-v2 .blog-prose p { margin-bottom: var(--space-4); }
.hint-v2 .blog-prose ul,
.hint-v2 .blog-prose ol {
  margin: var(--space-3) 0 var(--space-4);
  padding-left: var(--space-6);
}
.hint-v2 .blog-prose ul { list-style: disc; }
.hint-v2 .blog-prose ol { list-style: decimal; }
.hint-v2 .blog-prose li { margin-bottom: var(--space-2); }
.hint-v2 .blog-prose a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.hint-v2 .blog-prose strong { font-weight: var(--fw-semibold); }
.hint-v2 .blog-prose blockquote {
  margin: var(--space-5) 0;
  padding: var(--space-3) var(--space-5);
  border-left: 3px solid var(--brand);
  background: var(--bg-quote);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}
.hint-v2 .blog-prose blockquote p:last-child { margin-bottom: 0; }
.hint-v2 .blog-prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-7) 0;
}
.hint-v2 .blog-prose img {
  display: block;
  max-width: 100%;
  margin: var(--space-5) 0;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.hint-v2 .blog-prose code {
  font-family: ui-monospace, monospace;
  font-size: var(--text-label);
  background: var(--bg-input);
  border-radius: var(--radius-xs);
  padding: var(--space-3xs) var(--space-2xs);
}
.hint-v2 .blog-prose pre {
  margin: var(--space-4) 0;
  padding: var(--space-4);
  background: var(--bg-input);
  border-radius: var(--radius-md);
  overflow-x: auto;
}
.hint-v2 .blog-prose pre code {
  background: none;
  padding: 0;
}
.hint-v2 .blog-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-4) 0;
  font-size: var(--text-label);
}
.hint-v2 .blog-prose th,
.hint-v2 .blog-prose td {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
}
.hint-v2 .blog-prose th { font-weight: var(--fw-semibold); }

/* ── Admin: editor layout ── */

.hint-v2 .blog-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: var(--space-5);
  align-items: start;
}
@media (max-width: 1000px) {
  .hint-v2 .blog-editor { grid-template-columns: minmax(0, 1fr); }
}

.hint-v2 .blog-ed-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.hint-v2 .blog-ed-textarea {
  min-height: 60vh;
  font-family: ui-monospace, monospace;
  font-size: var(--text-label);
  line-height: var(--leading-relaxed);
  resize: vertical;
}
.hint-v2 .blog-ed-preview {
  min-height: 60vh;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  background: var(--bg-surface);
}
.hint-v2 .blog-ed-hidden { display: none; }

.hint-v2 .blog-ed-cover {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
}

/* ── Admin: upload affordances + taxonomy bits ── */

/* A <label> styled as a button hosting a visually-hidden InputFile (the
   SettingsBusinessPanel idiom) — clicking the label opens the file picker. */
.hint-v2 .blog-upload { position: relative; overflow: hidden; cursor: pointer; }
.hint-v2 .blog-file {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* The shared .avatar tile is letter-sized; when it hosts an uploaded photo the
   image must cover the tile instead of stretching. */
.hint-v2 img.avatar { object-fit: cover; }

.hint-v2 .blog-author-cell {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.hint-v2 .blog-author-cell .avatar { flex-shrink: 0; }
.hint-v2 .blog-avatar-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
