/* ── Blog page ────────────────────────────────────────────────── */
/*
 * .blog-wrap is the outermost centering shell.
 * On the list view it is wider (sidebar + gap + content) so that the
 * sidebar + posts together are centered in the viewport.
 * On the detail view .blog-page handles centering directly.
 */
.blog-wrap {
  max-width: 1304px; /* 200px sidebar + 24px gap + 1080px content */
  margin: 0 auto;
  padding: 88px 24px 96px;
  font-family: var(--ff-body, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  background: var(--c-bg);
  color: var(--c-text);
}

.blog-page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 88px 24px 96px;
  font-family: var(--ff-body, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  background: var(--c-bg);
  color: var(--c-text);
}

.blog-page__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 40px;
}

.blog-page__header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--c-text-head);
}

.btn-new-post {
  font-size: 14px;
  font-weight: 500;
  color: var(--c-accent);
  text-decoration: none;
}
.btn-new-post:hover { text-decoration: underline; }

.blog-page__empty {
  color: var(--c-text-muted);
  font-size: 16px;
}

/* ── Layout wrapper ──────────────────────────────────────────── */
/*
 * .blog-outer is a two-column grid: sidebar (200px) + main (1fr).
 * .blog-wrap is the wider centering shell so both columns are visually
 * centered together in the viewport.
 * In search mode (no sidebar) a single-column modifier removes the gap.
 */
.blog-outer {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  align-items: start;
}

.blog-outer--search {
  grid-template-columns: 1fr;
}

/* In search mode the sidebar is gone; cap to content width */
.blog-wrap--search {
  max-width: 1080px;
}

/* ── Sidebar filter ──────────────────────────────────────────── */
.blog-sidebar {
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.blog-filter {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 16px;
  background: var(--c-bg-alt);
  border: 1px solid var(--c-border);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 1px 3px rgba(0,0,0,0.04);
}

.blog-filter__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-text-muted);
}

.blog-filter__pills {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.blog-filter__pill {
  display: block;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  border: 1px solid transparent;
  color: var(--c-text-muted);
  background: transparent;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}

.blog-filter__pill:hover {
  color: var(--pill-color, var(--c-accent));
  background: color-mix(in srgb, var(--pill-color, var(--c-accent)) 8%, transparent);
}

.blog-filter__pill--active {
  background: color-mix(in srgb, var(--pill-color, var(--c-accent)) 12%, transparent);
  border-color: color-mix(in srgb, var(--pill-color, var(--c-accent)) 40%, transparent);
  color: var(--pill-color, var(--c-accent));
  font-weight: 600;
}

/* ── Sort radio rows ─────────────────────────────────────────── */
.blog-filter__radio-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-muted);
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.12s, color 0.12s;
}
.blog-filter__radio-row:hover {
  background: color-mix(in srgb, var(--c-accent) 8%, transparent);
  color: var(--c-accent);
}
.blog-filter__radio-row input[type="radio"] {
  accent-color: var(--c-accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* Date range inputs */
.blog-filter__range-picker {
  padding: 6px 4px 4px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.blog-filter__range-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 4px;
}
.blog-filter__range-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-text-muted);
  width: 28px;
  flex-shrink: 0;
}
.blog-filter__date-input {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-family: var(--ff-body);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--c-border);
  background: var(--c-bg-card);
  color: var(--c-text);
  outline: none;
  transition: border-color 0.15s;
}
.blog-filter__date-input:focus {
  border-color: var(--c-accent);
}

/* Collapsible block */
details.blog-filter--collapsible {
  padding: 0;         /* override .blog-filter padding — summary owns it */
  gap: 0;
}
.blog-filter__collapse-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  list-style: none;
  padding: 18px 16px;
}
.blog-filter__collapse-toggle::-webkit-details-marker { display: none; }
.blog-filter__collapse-caret {
  font-size: inherit;
  line-height: 1;
  color: var(--c-text-muted);
  transition: transform 0.18s ease;
  display: flex;
  align-items: center;
}
details.blog-filter--collapsible[open] .blog-filter__collapse-caret {
  transform: rotate(180deg);
}
details.blog-filter--collapsible .blog-filter__pills,
details.blog-filter--collapsible .blog-filter__sort {
  padding: 0 16px 16px;
}

/* Action pill (New post) */
.blog-filter__pill--action {
  color: var(--c-accent);
  font-weight: 600;
}
.blog-filter__pill--action:hover {
  color: var(--c-accent);
  background: color-mix(in srgb, var(--c-accent) 10%, transparent);
}

/* Dropdown trigger pill */
.blog-filter__pill--dropdown {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 400;
  font-style: italic;
  color: var(--c-text-muted);
  opacity: 0.7;
  padding: 5px 12px;
  cursor: pointer;
  font-family: var(--ff-body);
  text-align: left;
  transition: border-color 0.12s, color 0.12s, background 0.12s, opacity 0.12s;
}
.blog-filter__pill--dropdown:hover {
  color: var(--c-text-muted);
  opacity: 1;
  background: color-mix(in srgb, var(--c-text-muted) 8%, transparent);
}
.blog-filter__caret {
  font-size: 11px;
  line-height: 1;
  margin-left: auto;
  opacity: 0.6;
  display: flex;
  align-items: center;
}

/* Advanced dropdown container */
.blog-filter__advanced {
  position: relative;
}

.blog-filter__dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  z-index: 100;
  overflow: hidden;
}

.blog-filter__dropdown-item {
  display: block;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--c-text);
  text-decoration: none;
  transition: background 0.1s;
}
.blog-filter__dropdown-item:hover {
  background: var(--c-bg-alt);
  color: var(--c-accent);
}

/* ── Author filter pills ─────────────────────────────────────── */
.blog-filter__author-pills {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.blog-filter__author-pill {
  display: block;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  border: 1px solid transparent;
  color: var(--c-text-muted);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}

.blog-filter__author-pill:hover {
  color: var(--c-accent);
  background: color-mix(in srgb, var(--c-accent) 8%, transparent);
}

.blog-filter__author-pill--active {
  background: color-mix(in srgb, var(--c-accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--c-accent) 40%, transparent);
  color: var(--c-accent);
  font-weight: 600;
}

/* ── Main content column ─────────────────────────────────────── */
.blog-main {
  min-width: 0; /* prevents grid blowout */
}

@media (max-width: 680px) {
  .blog-wrap {
    padding-top: 72px;
  }
  .blog-outer {
    grid-template-columns: 1fr;
  }
  .blog-sidebar {
    position: static;
  }
  .blog-filter__pills {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .blog-filter__pill {
    display: inline-block;
    border-radius: 999px;
    padding: 5px 13px;
  }
  .blog-sidebar .dept-pill__short { display: inline; }
  .blog-sidebar .dept-pill__full  { display: none; }
}

/* ── Post action links (edit / delete / view) ────────────────── */
.post-card__actions {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  gap: 6px;
}

.post-card__action-link {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--c-border);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
  color: var(--c-text-muted);
  background: transparent;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.post-card__action-link:hover {
  border-color: var(--c-text-muted);
  color: var(--c-text);
  background: rgba(128,128,128,0.07);
}
.post-card__action-link--delete:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239,68,68,0.06);
}

/* ── Feed ────────────────────────────────────────────────────── */
.post-feed {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ── Post card ───────────────────────────────────────────────── */
.post-card {
  background: var(--c-bg-alt);
  border: 1px solid var(--c-border);
  border-radius: 16px;
  padding: 36px 40px;
}

.post-card__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--c-text-muted);
  margin-bottom: 10px;
}

.post-card__author {
  font-weight: 600;
  color: var(--c-text);
}

.post-card__sep {
  color: var(--c-text-muted);
}

/* Small inline avatar next to author name */
.post-card__author-avatar {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 4px;
  object-fit: cover;
  position: relative;
  top: -0.08em;
}

.post-card__author-avatar--placeholder {
  background: var(--c-border);
}

/* Author name clickable — no mention-pill coloring */
.post-card__author--clickable {
  cursor: pointer;
}
.post-card__author--clickable:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* dept-pill responsive name:
 * - single pill  → full name
 * - two+ pills   → short name
 * - mobile       → always short name
 * Trick: if a .dept-pill has a .dept-pill sibling, both show short.
 * :has() targets the first; the adjacent sibling ~ selector targets the rest.
 */
.dept-pill__short { display: none; }
.dept-pill__full  { display: inline; }

/* any pill that has a dept-pill sibling → short */
.dept-pill:has(~ .dept-pill) .dept-pill__short,
.dept-pill:has(~ .dept-pill) ~ .dept-pill .dept-pill__short { display: inline; }
.dept-pill:has(~ .dept-pill) .dept-pill__full,
.dept-pill:has(~ .dept-pill) ~ .dept-pill .dept-pill__full  { display: none; }

@media (max-width: 680px) {
  .dept-pill__short { display: inline; }
  .dept-pill__full  { display: none; }
}


/* .post-card__dept-pill → use .dept-pill */

.post-card__title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.25;
  margin: 20px 0;
  color: var(--c-text-head);
}

/* ── Prose (rendered markdown) ───────────────────────────────── */
.prose { line-height: 1.75; font-size: 15px; color: var(--c-text); }
.prose h1, .prose h2, .prose h3, .prose h4 {
  font-weight: 700; line-height: 1.2; margin: 1.6em 0 0.5em; letter-spacing: -0.2px; color: var(--c-text-head);
}
.prose h1 { font-size: 1.5rem; }
.prose h2 { font-size: 1.2rem; }
.prose h3 { font-size: 1rem; }
.prose p  { margin: 0 0 1em; }
.prose ul, .prose ol { margin: 0 0 1em 1.4em; }
.prose li { margin-bottom: 0.35em; }
.prose a  { color: var(--c-accent); text-decoration: none; }
.prose a:hover { text-decoration: underline; }
.prose blockquote {
  border-left: 3px solid var(--c-border);
  margin: 0 0 1em;
  padding: 2px 0 2px 18px;
  color: var(--c-text-muted);
  font-style: italic;
}
.prose code {
  background: rgba(128,128,128,0.12);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 0.87em;
  font-family: "SF Mono", "Fira Code", monospace;
}
.prose pre {
  background: var(--c-bg-card);
  color: var(--c-text);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 18px 22px;
  overflow-x: auto;
  margin: 0 0 1.2em;
}
.prose pre code { background: none; padding: 0; color: inherit; font-size: 0.88em; }
.prose img { max-width: 100%; border-radius: 8px; margin: 0.8em 0; }
.prose hr { border: none; border-top: 1px solid var(--c-border); margin: 1.6em 0; }
.prose table { border-collapse: collapse; width: 100%; margin-bottom: 1em; font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--c-border); padding: 7px 12px; text-align: left; }
.prose th { background: rgba(128,128,128,0.08); font-weight: 600; }

/* ── Post form helpers ───────────────────────────────────────── */
.post-field-hint { font-weight: 400; color: #999; font-size: 12px; }

/* ── Department / author picker shared ──────────────────────── */
.dept-picker__controls,
.author-picker {
  position: relative;
}

/* Tag box — shows selected dept pills */
.dept-picker__box {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid #d4d4d5;
  border-radius: 6px;
  background: #fff;
  margin-bottom: 8px;
}

.dept-picker__placeholder {
  font-size: 13px;
  color: #aaa;
  pointer-events: none;
}

/* Dept pill + remove button wrapper */
.dept-picker__tag-wrap {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.dept-picker__tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: rgba(0,0,0,0.45);
  padding: 0 2px;
}
.dept-picker__tag-remove:hover { color: #000; }

/* Controls row: add button + dropdown anchor */
.dept-picker__controls {
  display: inline-block;
  margin-bottom: 6px;
}

/* Add / Choose button */
.dept-picker__add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px dashed #bbb;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
  white-space: nowrap;
}
.dept-picker__add-btn:hover:not(:disabled) { border-color: #3949ab; color: #3949ab; }
.dept-picker__add-btn--disabled,
.dept-picker__add-btn:disabled { opacity: 0.38; cursor: not-allowed; pointer-events: none; }

/* Shared dropdown */
.dept-picker__dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 200;
  background: #fff;
  border: 1px solid #d4d4d5;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  min-width: 180px;
  overflow: hidden;
}

.dept-picker__option {
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.08s;
}
.dept-picker__option:hover:not(.dept-picker__option--disabled) { background: #f0f2ff; color: #3949ab; }
.dept-picker__option--hidden { display: none; }
.dept-picker__option--disabled { color: #ccc; cursor: default; }

/* General dept radio row */
.dept-picker__general {
  margin-top: 8px;
}
.dept-picker__general-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #555;
  cursor: pointer;
  font-weight: normal;
}
.dept-picker__general-label input[type="radio"] {
  accent-color: #3949ab;
  cursor: pointer;
}

/* ── Author pill (inside tag box) ───────────────────────────── */
.author-picker__pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: rgba(128,128,128,0.13);
  color: #333;
  white-space: nowrap;
  vertical-align: middle;
}

/* ── Martor editor wrapper — border + height ────────────────── */
.martor-editor-wrap {
  border: 1px solid #d4d4d5;
  border-radius: 8px;
  overflow: hidden;
}

.martor-editor-wrap .martor-field {
  min-height: 420px !important;
}

/* ── Toolbar buttons with labels ────────────────────────────── */

/* Toolbar button: flex column so label sits under icon */
.martor-toolbar .ui.button.no-border {
  display: inline-flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  height: auto !important;
  min-height: 0 !important;
  overflow: visible !important;
  padding: 5px 7px 4px !important;
  line-height: 1 !important;
}

/* The buttons group itself must not clip */
.martor-toolbar .ui.basic.tiny.buttons.martor-toolbar-inner {
  overflow: visible !important;
  height: auto !important;
}

/* Label text under icon */
.martor-btn-label {
  display: block;
  font-size: 9px;
  line-height: 1;
  margin-top: 3px;
  color: inherit;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  pointer-events: none;
}

/* Upload button: keep the file input as an invisible overlay */
.martor-toolbar .markdown-image-upload {
  position: relative;
  overflow: hidden !important;
}
.martor-toolbar .markdown-image-upload input[type="file"] {
  position: absolute;
  top: 0; right: 0;
  min-width: 100%; min-height: 100%;
  font-size: 25px;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

/* ── Mention (rendered inside .prose) ───────────────────────── */
.mention-pill {
  display: inline;
  font-weight: 700;
  color: var(--mention-color, #64748b);
  cursor: pointer;
  border-radius: 999px;
  padding: 2px 6px;
  background: transparent;
  box-shadow: none;
  transition: background 0.14s, box-shadow 0.14s;
  white-space: nowrap;
}
.mention-pill:hover {
  background: color-mix(in srgb, var(--mention-color, #64748b) 15%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--mention-color, #64748b) 30%, transparent);
}

/* ── Mention popup overlay ───────────────────────────────────── */
.mention-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
}

.mention-popup {
  position: relative;
  max-width: 420px;
  width: 90vw;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Close button — absolutely positioned top-left, outside the card */
@media (max-width: 680px) {
  .mention-popup__close { display: none; }
}

.mention-popup__close {
  position: absolute;
  top: 8px;
  left: -40px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.mention-popup__close:hover {
  background: transparent;
}
.mention-popup__close svg {
  width: 14px;
  height: 14px;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
}

/* Blog posts link — same radius as team card, low-opacity accent solid bg */
.mention-popup__blog-link {
  display: block;
  padding: 10px 16px;
  border: 1px solid rgba(57, 73, 171, 0.3);
  border-radius: 16px;
  text-align: center;
  text-decoration: none;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  background: rgba(57, 73, 171, 0.30);
  transition: border-color 0.12s, background 0.12s;
}
.mention-popup__blog-link:hover {
  border-color: rgba(57, 73, 171, 0.6);
  background: rgba(57, 73, 171, 0.13);
}
[data-theme="dark"] .mention-popup__blog-link {
  color: var(--c-accent);
}

/* ── Search results main feed ────────────────────────────────── */
.blog-search__heading {
  font-size: 13px;
  color: var(--c-text-muted);
  margin-bottom: 20px;
}

.blog-search__heading strong {
  color: var(--c-text);
}

.post-card__search-snippet {
  font-size: 14px;
  color: var(--c-text-muted);
  line-height: 1.6;
}

.post-card__search-snippet mark {
  background: color-mix(in srgb, var(--c-accent) 20%, transparent);
  color: var(--c-accent);
  border-radius: 3px;
  padding: 0 2px;
  font-style: normal;
}

/* ── Post detail layout ──────────────────────────────────────── */
.blog-detail__back {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-muted);
  text-decoration: none;
  margin-bottom: 24px;
  transition: color 0.12s;
}

.blog-detail__back:hover {
  color: var(--c-accent);
}

.dept-pill--sm {
  font-size: 10px;
  padding: 1px 6px;
}
