/* Post listing styles — atomic naming convention */

/* === ATOMS === */

/* Cover image — square (Flutter: width = screen width, height = width) */
.a-cover-img {
  aspect-ratio: 1 / 1;
  object-fit: cover;
  width: 100%;
  display: block;
}

.a-cover-placeholder {
  aspect-ratio: 1 / 1;
  background-color: #f0f0f0;
}

/* Category badge */
.a-category-badge {
  font-family: var(--omm-font-stack);
  font-size: 12px;
  font-weight: 200;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #000;
}

/* Date */
.a-date-published {
  font-family: var(--omm-font-stack);
  font-size: 12px;
  font-weight: 200;
  color: #000;
}

/* === MOLECULES === */

/* Post card — Flutter: grey divider between cards, 8px, Colors.grey.withOpacity(.25) */
.m-post-card {
  border-bottom: 8px solid rgba(128, 128, 128, 0.25);
}

.m-post-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}
.m-post-card-link:hover {
  text-decoration: none;
  color: inherit;
}

.m-post-card-body {
  padding: 0;
}

/* Title — Flutter parity: 23px w200 black, padding 16/16/16/4 */
.m-post-card-title {
  font-family: var(--omm-font-stack);
  font-size: 23px;
  font-weight: 200;
  line-height: 1.3;
  display: block;
  color: #000;
  padding: 1rem 1rem 0.25rem;
}

/* Meta row (date + category) */
.m-post-card-meta {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0 1rem;
}

/* Actions row — Flutter: spaceBetween, stats left, buttons right */
.m-post-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0.5rem;
}

/* Stats (likes + views) — Flutter: horizontal Row, 12px w200 black, 48px height */
.m-post-card-stats {
  display: flex;
  align-items: center;
  height: 48px;
  padding-left: 0.5rem;
}

.m-post-card-stat {
  font-family: var(--omm-font-stack);
  font-size: 12px;
  font-weight: 200;
  color: #000;
  white-space: nowrap;
}

.m-post-card-stat-sep {
  width: 1rem;
}

/* Like button — Flutter: 48x48 */
.m-post-card-like-btn {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #000;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0;
}
.m-post-card-like-btn--active {
  color: var(--omm-brand-color, #193857);
}

/* More button — Flutter: 48x48 horizontal ellipsis */
.m-post-card-more-btn {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #000;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0;
}

.m-post-card-buttons {
  display: flex;
  align-items: center;
}

/* Post card "more" bottom sheet — matches CEWL (contacts, events, weblinks, locations) more modal styling */

/* === RESPONSIVE === */

/* Mobile: cover images edge-to-edge, divider edge-to-edge */
@media (max-width: 767.98px) {
  .m-post-card {
    margin-left: -0.75rem;
    margin-right: -0.75rem;
  }

  .m-post-card-title {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .m-post-card-meta {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .m-post-card-actions {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .o-cat-header {
    margin-left: -0.75rem;
    margin-right: -0.75rem;
  }
}

/* === ORGANISMS === */

/* Category header (Flutter: ArticlePageCategoryHeader + ArticlePageCategoryHeaderArea) */
/* Image as container background (BoxFit.cover), text left-aligned on top with solid brand-color boxes */
.o-cat-header {
  position: relative;
  overflow: hidden;
  margin-bottom: 1rem;
}

/* Cover image fills the container, establishes height via natural aspect ratio */
.o-cat-header-img {
  width: 100%;
  height: auto;
  display: block;
}

/* Text overlay: positioned over image, left-aligned */
/* Flutter: 48pt top spacer, 32pt bottom spacer, ~8% left offset (1/12 grid) */
.o-cat-header-meta {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 3rem 1rem 2rem 8%;
}

/* Parent category line — Flutter: 11px w400 white, 0.6 opacity, brand-color bg box */
.o-cat-header-parent {
  margin-bottom: 4px;
  opacity: 0.6;
}
.o-cat-header-parent span {
  font-family: var(--omm-font-stack);
  font-size: 11px;
  font-weight: 400;
  color: #fff;
  background-color: var(--omm-brand-color, #193857);
  padding: 4px 8px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* Category name — Flutter: 23px w200 white, brand-color bg box */
.o-cat-header-name span {
  font-family: var(--omm-font-stack);
  font-size: 23px;
  font-weight: 200;
  color: #fff;
  background-color: var(--omm-brand-color, #193857);
  padding: 4px 8px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* No-image variant — Flutter: brand-color bg, black text, 24px w400, min 96pt height */
.o-cat-header--no-img {
  background-color: var(--omm-brand-color, #193857);
  min-height: 96px;
}
.o-cat-header--no-img .o-cat-header-meta {
  position: static;
  padding: 3rem 1rem 2rem 8%;
}
.o-cat-header--no-img .o-cat-header-parent span,
.o-cat-header--no-img .o-cat-header-name span {
  background: none;
  color: #000;
}
.o-cat-header--no-img .o-cat-header-name span {
  font-size: 24px;
  font-weight: 400;
}

/* Posts list loader */
.o-posts-loader .spinner-border {
  width: 2rem;
  height: 2rem;
  color: #888;
}

/* === Post embed link card ===
   The compact card for post link/embed blocks (by design:
   64px thumb left — the o-block-episode-cover compact-reference size —
   title/meta right). Same m-post-card markup + atoms as the list card;
   coverless targets render title/meta only; no reactions bar in embed
   context. */
.m-post-card--embed {
  border: 1px solid var(--bs-border-color, #dee2e6);
  margin: 0 0 2rem;
  padding: 0.75rem 1rem;
}
.m-post-card--embed .m-post-card-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}
.m-post-card--embed .a-cover-img {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}
.m-post-card--embed .m-post-card-body {
  min-width: 0;
}
.m-post-card--embed .m-post-card-title {
  font-size: 17px;
  padding: 0 0 0.25rem;
}
.m-post-card--embed .m-post-card-meta {
  padding: 0;
}

/* ============================================================
   o-search-* — the /search page furniture.
   Header = count + query (o-cat-header's information role, lighter
   form); results are m-post-card UNCHANGED; empty state follows the
   list empty-state voice + one actionable hint. */
.o-search-header {
  margin: 1.5rem 0 1rem;
}
.o-search-header-count {
  font-size: 13px;
  color: #6c757d;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.o-search-header-query {
  font-size: 22px;
  font-weight: 600;
}
.o-search-empty {
  text-align: center;
  color: #6c757d;
  margin-top: 3rem;
}
.o-search-empty .bi {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

/* ============================================================
   The scoped set filter. o-cat-header-search is
   the CEWL trigger anatomy VERBATIM (m-post-hero-cewl-link,
   omm_post_detail.css — 2rem brand circle, white glyph, absolute
   top-right 1rem) transplanted to o-cat-header (position: relative
   above). On the no-img band the circle INVERTS (white on the brand
   colour — the same inversion the band applies to its text); on cover images
   it stays the brand colour like the CEWL trigger. Tap toggles the o-posts-filter
   field below the header (autofocus; Esc closes). Renders only when the
   set has posts (or a filter is active, so it can be cleared). */
.o-cat-header-search {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: none;
  background-color: var(--omm-brand-color, #193857);
  color: #fff;
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  transition: opacity 0.2s ease;
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
}
.o-cat-header-search:hover {
  opacity: 0.85;
}
.o-cat-header-search--active {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7);
}
.o-cat-header--no-img .o-cat-header-search {
  background: #fff;
  color: var(--omm-brand-color, #193857);
}
.o-cat-header--no-img .o-cat-header-search--active {
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25);
}
/* the revealed field — hidden until the trigger opens it; placeholder
   names the SET ("Search in <category name>") so scope is unambiguous.
   Fused flex: input + magnifier submit share one 1px edge, equal height
   by construction (tap target for touch; Enter still submits). */
.o-posts-filter {
  margin: 1rem 0 1.25rem;
  display: flex;
}
.o-posts-filter[hidden] {
  display: none;
}
.o-posts-filter input {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-right: none;
}
.o-posts-filter button {
  border: 1px solid #ced4da;
  background: #fff;
  color: #6c757d;
  font-size: 14px;
  line-height: 1;
  padding: 8px 12px;
  cursor: pointer;
}
.o-posts-filter button:hover {
  color: #212529;
}
/* ONE border in every state, and no focus outline (outline: none below):
   focus indicated by the caret alone —
   any focus-driven color/outline change reads as the border "flickering"
   as focus moves between the field, the drawer, and back-nav restores.
   The ::-webkit-search-cancel-button ✕ (a UA feature of type=search when
   the input holds a value, surfaced by Unpoly back-restores) is hidden. */
.o-posts-filter input:focus,
.o-posts-filter input:focus-visible {
  outline: none;
  border-color: #ced4da;
}
.o-posts-filter input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}
