/*
  Citadel grouped pill system v1.
  Reusable category, tag, technical, meta and filter/action pill treatment.
  This module is Citadel-level and intentionally avoids Chambers-specific selectors.
*/

:root {
  --citadel-pill-gap: clamp(0.38rem, 0.8vw, 0.58rem);
  --citadel-pill-radius-category: 2px;
  --citadel-pill-radius-tag: 999px;
  --citadel-pill-category-min-height: 30px;
  --citadel-pill-tag-min-height: 28px;
  --citadel-pill-meta-min-height: 26px;
  --citadel-pill-filter-min-height: 38px;
  --citadel-pill-tag-min-width: clamp(4.75rem, 8vw, 7.25rem);
  --citadel-pill-tag-max-width: min(100%, 24ch);
  --citadel-pill-technical-max-width: min(100%, 34ch);
}

/* Base future-facing class. Existing markup is mapped below for compatibility. */
.citadel-pill {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-style: solid;
  border-width: 1px;
  font-family: var(--font-body);
  font-weight: 700;
  line-height: 1.12;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

/* Containers shared by insight cards and article footers. */
[data-theme^="citadel-of-ak"] .insight-card-tags,
[data-theme^="citadel-of-ak"] .article-tag-list,
[data-theme="dark"] .insight-card-tags,
[data-theme="dark"] .article-tag-list,
.theme-citadel-active .insight-card-tags,
.theme-citadel-active .article-tag-list {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--citadel-pill-gap);
}

/* Category pills: strongest identity, used for content type. */
[data-theme^="citadel-of-ak"] .update-tag,
[data-theme^="citadel-of-ak"] .article-tag,
[data-theme^="citadel-of-ak"] .latest-card-category,
[data-theme^="citadel-of-ak"] .tag-case-brief,
[data-theme^="citadel-of-ak"] .tag-checklist,
[data-theme^="citadel-of-ak"] .tag-guide,
[data-theme^="citadel-of-ak"] .tag-procedure,
[data-theme^="citadel-of-ak"] .tag-update,
[data-theme^="citadel-of-ak"] .tag-legal-update,
[data-theme^="citadel-of-ak"] .citadel-pill-category,
[data-theme="dark"] .update-tag,
[data-theme="dark"] .article-tag,
[data-theme="dark"] .latest-card-category,
[data-theme="dark"] .tag-case-brief,
[data-theme="dark"] .tag-checklist,
[data-theme="dark"] .tag-guide,
[data-theme="dark"] .tag-procedure,
[data-theme="dark"] .tag-update,
[data-theme="dark"] .tag-legal-update,
[data-theme="dark"] .citadel-pill-category,
.theme-citadel-active .update-tag,
.theme-citadel-active .article-tag,
.theme-citadel-active .latest-card-category,
.theme-citadel-active .tag-case-brief,
.theme-citadel-active .tag-checklist,
.theme-citadel-active .tag-guide,
.theme-citadel-active .tag-procedure,
.theme-citadel-active .tag-update,
.theme-citadel-active .tag-legal-update,
.theme-citadel-active .citadel-pill-category {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  min-height: var(--citadel-pill-category-min-height);
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(var(--rgb-gold), 0.64);
  border-radius: var(--citadel-pill-radius-category);
  background:
    linear-gradient(180deg, rgba(var(--rgb-gold), 0.2), rgba(var(--rgb-gold), 0.08)),
    rgba(var(--rgb-white), 0.68);
  color: var(--color-gold-deep);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1.1;
  padding: 0.45rem 0.78rem;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(var(--rgb-white), 0.24);
}

/* Tag pills: supporting topics, repeatable and lighter than categories. */
[data-theme^="citadel-of-ak"] .insight-card-tags span,
[data-theme^="citadel-of-ak"] .insight-card-tags a,
[data-theme^="citadel-of-ak"] .article-tag-list a,
[data-theme^="citadel-of-ak"] .citadel-pill-tag,
[data-theme="dark"] .insight-card-tags span,
[data-theme="dark"] .insight-card-tags a,
[data-theme="dark"] .article-tag-list a,
[data-theme="dark"] .citadel-pill-tag,
.theme-citadel-active .insight-card-tags span,
.theme-citadel-active .insight-card-tags a,
.theme-citadel-active .article-tag-list a,
.theme-citadel-active .citadel-pill-tag {
  display: inline-flex;
  flex: 0 1 auto;
  min-width: var(--citadel-pill-tag-min-width);
  max-width: var(--citadel-pill-tag-max-width);
  min-height: var(--citadel-pill-tag-min-height);
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(var(--rgb-gold), 0.38);
  border-radius: var(--citadel-pill-radius-tag);
  background: rgba(var(--rgb-gold), 0.08);
  color: var(--color-gold-deep);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.075em;
  line-height: 1.15;
  overflow-wrap: anywhere;
  padding: 0.4rem 0.68rem;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  white-space: normal;
}

/* Long legal/statutory tags: same family, more breathing room. */
[data-theme^="citadel-of-ak"] .citadel-pill-technical,
[data-theme="dark"] .citadel-pill-technical,
.theme-citadel-active .citadel-pill-technical {
  max-width: var(--citadel-pill-technical-max-width);
  min-width: min(100%, 10.5rem);
  padding-inline: 0.86rem;
}

[data-theme^="citadel-of-ak"] .insight-card-tags span:nth-child(n+5),
[data-theme^="citadel-of-ak"] .insight-card-tags a:nth-child(n+5),
[data-theme="dark"] .insight-card-tags span:nth-child(n+5),
[data-theme="dark"] .insight-card-tags a:nth-child(n+5),
.theme-citadel-active .insight-card-tags span:nth-child(n+5),
.theme-citadel-active .insight-card-tags a:nth-child(n+5) {
  max-width: var(--citadel-pill-technical-max-width);
}

/* Meta pills: quieter labels for dates, article metadata and status. */
[data-theme^="citadel-of-ak"] .article-meta span,
[data-theme^="citadel-of-ak"] .citadel-pill-meta,
[data-theme="dark"] .article-meta span,
[data-theme="dark"] .citadel-pill-meta,
.theme-citadel-active .article-meta span,
.theme-citadel-active .citadel-pill-meta {
  display: inline-flex;
  min-height: var(--citadel-pill-meta-min-height);
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(var(--rgb-ink), 0.14);
  border-radius: var(--citadel-pill-radius-tag);
  background: rgba(var(--rgb-white), 0.48);
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.12;
  padding: 0.34rem 0.62rem;
  text-align: center;
  text-transform: uppercase;
}

/* Filter/action pills: clearly interactive. */
[data-theme^="citadel-of-ak"] .insights-filter,
[data-theme^="citadel-of-ak"] .insights-page-button,
[data-theme^="citadel-of-ak"] .citadel-pill-filter,
[data-theme="dark"] .insights-filter,
[data-theme="dark"] .insights-page-button,
[data-theme="dark"] .citadel-pill-filter,
.theme-citadel-active .insights-filter,
.theme-citadel-active .insights-page-button,
.theme-citadel-active .citadel-pill-filter {
  min-height: var(--citadel-pill-filter-min-height);
  border: 1px solid rgba(var(--rgb-gold), 0.5);
  border-radius: var(--citadel-pill-radius-tag);
  background: rgba(var(--rgb-white), 0.58);
  color: var(--color-gold-deep);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1.1;
  padding: 0.58rem 0.9rem;
  text-align: center;
  text-transform: uppercase;
}

[data-theme^="citadel-of-ak"] .insight-card-tags a:hover,
[data-theme^="citadel-of-ak"] .article-tag-list a:hover,
[data-theme^="citadel-of-ak"] .insights-filter:hover,
[data-theme^="citadel-of-ak"] .insights-filter.is-active,
[data-theme^="citadel-of-ak"] .insights-page-button:hover,
[data-theme^="citadel-of-ak"] .citadel-pill-filter:hover,
[data-theme^="citadel-of-ak"] .citadel-pill-filter.is-active,
[data-theme="dark"] .insight-card-tags a:hover,
[data-theme="dark"] .article-tag-list a:hover,
[data-theme="dark"] .insights-filter:hover,
[data-theme="dark"] .insights-filter.is-active,
[data-theme="dark"] .insights-page-button:hover,
[data-theme="dark"] .citadel-pill-filter:hover,
[data-theme="dark"] .citadel-pill-filter.is-active,
.theme-citadel-active .insight-card-tags a:hover,
.theme-citadel-active .article-tag-list a:hover,
.theme-citadel-active .insights-filter:hover,
.theme-citadel-active .insights-filter.is-active,
.theme-citadel-active .insights-page-button:hover,
.theme-citadel-active .citadel-pill-filter:hover,
.theme-citadel-active .citadel-pill-filter.is-active {
  border-color: rgba(var(--rgb-gold), 0.78);
  background: rgba(var(--rgb-gold), 0.16);
  color: var(--color-ink);
  transform: translateY(-1px);
}

[data-theme^="citadel-of-ak"] .insight-card-tags a:focus-visible,
[data-theme^="citadel-of-ak"] .article-tag-list a:focus-visible,
[data-theme^="citadel-of-ak"] .insights-filter:focus-visible,
[data-theme^="citadel-of-ak"] .insights-page-button:focus-visible,
[data-theme^="citadel-of-ak"] .citadel-pill:focus-visible,
[data-theme="dark"] .insight-card-tags a:focus-visible,
[data-theme="dark"] .article-tag-list a:focus-visible,
[data-theme="dark"] .insights-filter:focus-visible,
[data-theme="dark"] .insights-page-button:focus-visible,
[data-theme="dark"] .citadel-pill:focus-visible,
.theme-citadel-active .insight-card-tags a:focus-visible,
.theme-citadel-active .article-tag-list a:focus-visible,
.theme-citadel-active .insights-filter:focus-visible,
.theme-citadel-active .insights-page-button:focus-visible,
.theme-citadel-active .citadel-pill:focus-visible {
  outline: 2px solid rgba(var(--rgb-gold), 0.78);
  outline-offset: 2px;
}

/* Dark mode contrast. */
[data-theme^="citadel-of-ak-dark"] .update-tag,
[data-theme^="citadel-of-ak-dark"] .article-tag,
[data-theme^="citadel-of-ak-dark"] .latest-card-category,
[data-theme^="citadel-of-ak-dark"] .tag-case-brief,
[data-theme^="citadel-of-ak-dark"] .tag-checklist,
[data-theme^="citadel-of-ak-dark"] .tag-guide,
[data-theme^="citadel-of-ak-dark"] .tag-procedure,
[data-theme^="citadel-of-ak-dark"] .tag-update,
[data-theme^="citadel-of-ak-dark"] .tag-legal-update,
[data-theme^="citadel-of-ak-dark"] .citadel-pill-category,
[data-theme^="citadel-of-ak-dark"] .insight-card-tags span,
[data-theme^="citadel-of-ak-dark"] .insight-card-tags a,
[data-theme^="citadel-of-ak-dark"] .article-tag-list a,
[data-theme^="citadel-of-ak-dark"] .citadel-pill-tag,
[data-theme^="citadel-of-ak-dark"] .insights-filter,
[data-theme^="citadel-of-ak-dark"] .insights-page-button,
[data-theme^="citadel-of-ak-dark"] .citadel-pill-filter,
[data-theme="dark"] .update-tag,
[data-theme="dark"] .article-tag,
[data-theme="dark"] .latest-card-category,
[data-theme="dark"] .tag-case-brief,
[data-theme="dark"] .tag-checklist,
[data-theme="dark"] .tag-guide,
[data-theme="dark"] .tag-procedure,
[data-theme="dark"] .tag-update,
[data-theme="dark"] .tag-legal-update,
[data-theme="dark"] .citadel-pill-category,
[data-theme="dark"] .insight-card-tags span,
[data-theme="dark"] .insight-card-tags a,
[data-theme="dark"] .article-tag-list a,
[data-theme="dark"] .citadel-pill-tag,
[data-theme="dark"] .insights-filter,
[data-theme="dark"] .insights-page-button,
[data-theme="dark"] .citadel-pill-filter {
  border-color: rgba(var(--rgb-gold), 0.62);
  background: linear-gradient(180deg, rgba(var(--rgb-gold), 0.2), rgba(var(--rgb-gold), 0.09));
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

[data-theme^="citadel-of-ak-dark"] .article-meta span,
[data-theme^="citadel-of-ak-dark"] .citadel-pill-meta,
[data-theme="dark"] .article-meta span,
[data-theme="dark"] .citadel-pill-meta {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.045);
  color: rgba(255, 255, 255, 0.72);
}

[data-theme^="citadel-of-ak-dark"] .insight-card-tags a:hover,
[data-theme^="citadel-of-ak-dark"] .article-tag-list a:hover,
[data-theme^="citadel-of-ak-dark"] .insights-filter:hover,
[data-theme^="citadel-of-ak-dark"] .insights-filter.is-active,
[data-theme^="citadel-of-ak-dark"] .insights-page-button:hover,
[data-theme^="citadel-of-ak-dark"] .citadel-pill-filter:hover,
[data-theme^="citadel-of-ak-dark"] .citadel-pill-filter.is-active,
[data-theme="dark"] .insight-card-tags a:hover,
[data-theme="dark"] .article-tag-list a:hover,
[data-theme="dark"] .insights-filter:hover,
[data-theme="dark"] .insights-filter.is-active,
[data-theme="dark"] .insights-page-button:hover,
[data-theme="dark"] .citadel-pill-filter:hover,
[data-theme="dark"] .citadel-pill-filter.is-active {
  border-color: rgba(var(--rgb-gold), 0.82);
  background: linear-gradient(180deg, rgba(var(--rgb-gold), 0.28), rgba(var(--rgb-gold), 0.14));
  color: #ffffff;
}

/* Small cards and mobile: keep wrapping balanced without forcing overflow. */
@media (max-width: 760px) {
  [data-theme^="citadel-of-ak"] .insight-card-tags,
  [data-theme^="citadel-of-ak"] .article-tag-list,
  [data-theme="dark"] .insight-card-tags,
  [data-theme="dark"] .article-tag-list,
  .theme-citadel-active .insight-card-tags,
  .theme-citadel-active .article-tag-list {
    gap: 0.42rem;
  }

  [data-theme^="citadel-of-ak"] .insight-card-tags span,
  [data-theme^="citadel-of-ak"] .insight-card-tags a,
  [data-theme^="citadel-of-ak"] .article-tag-list a,
  [data-theme="dark"] .insight-card-tags span,
  [data-theme="dark"] .insight-card-tags a,
  [data-theme="dark"] .article-tag-list a,
  .theme-citadel-active .insight-card-tags span,
  .theme-citadel-active .insight-card-tags a,
  .theme-citadel-active .article-tag-list a {
    min-width: min(100%, 6.25rem);
    max-width: min(100%, 20rem);
  }

  [data-theme^="citadel-of-ak"] .insights-filter,
  [data-theme^="citadel-of-ak"] .insights-page-button,
  [data-theme="dark"] .insights-filter,
  [data-theme="dark"] .insights-page-button,
  .theme-citadel-active .insights-filter,
  .theme-citadel-active .insights-page-button {
    min-height: 40px;
  }
}
/* CITADEL PILL GROUP COLOR NORMALIZATION V2 */
:root {
  --citadel-pill-category-border: rgba(var(--rgb-gold), 0.72);
  --citadel-pill-category-bg:
    linear-gradient(180deg, rgba(var(--rgb-gold), 0.24), rgba(var(--rgb-gold), 0.11)),
    rgba(var(--rgb-white), 0.7);
  --citadel-pill-category-text: var(--color-gold-deep);
  --citadel-pill-category-shadow: inset 0 0 0 1px rgba(var(--rgb-white), 0.22);

  --citadel-pill-tag-border: rgba(var(--rgb-gold), 0.46);
  --citadel-pill-tag-bg: rgba(var(--rgb-gold), 0.08);
  --citadel-pill-tag-text: var(--color-gold-deep);
  --citadel-pill-tag-shadow: none;

  --citadel-pill-meta-border: rgba(var(--rgb-ink), 0.16);
  --citadel-pill-meta-bg: rgba(var(--rgb-white), 0.42);
  --citadel-pill-meta-text: var(--text-muted);

  --citadel-pill-filter-border: rgba(var(--rgb-gold), 0.58);
  --citadel-pill-filter-bg: rgba(var(--rgb-white), 0.58);
  --citadel-pill-filter-text: var(--color-gold-deep);
}

[data-theme^="citadel-of-ak-dark"],
[data-theme="dark"] {
  --citadel-pill-category-border: rgba(var(--rgb-gold), 0.78);
  --citadel-pill-category-bg: linear-gradient(180deg, rgba(var(--rgb-gold), 0.28), rgba(var(--rgb-gold), 0.14));
  --citadel-pill-category-text: #ffffff;
  --citadel-pill-category-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.045);

  --citadel-pill-tag-border: rgba(var(--rgb-gold), 0.56);
  --citadel-pill-tag-bg: rgba(var(--rgb-gold), 0.09);
  --citadel-pill-tag-text: #e6c364;
  --citadel-pill-tag-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);

  --citadel-pill-meta-border: rgba(255, 255, 255, 0.18);
  --citadel-pill-meta-bg: rgba(255, 255, 255, 0.045);
  --citadel-pill-meta-text: rgba(255, 255, 255, 0.72);

  --citadel-pill-filter-border: rgba(var(--rgb-gold), 0.66);
  --citadel-pill-filter-bg: rgba(var(--rgb-gold), 0.1);
  --citadel-pill-filter-text: #e6c364;
}

/* Category pills must share one visual language regardless of label. */
[data-theme^="citadel-of-ak"] .update-tag,
[data-theme^="citadel-of-ak"] .article-tag,
[data-theme^="citadel-of-ak"] .latest-card-category,
[data-theme^="citadel-of-ak"] .tag-case-brief,
[data-theme^="citadel-of-ak"] .tag-checklist,
[data-theme^="citadel-of-ak"] .tag-guide,
[data-theme^="citadel-of-ak"] .tag-procedure,
[data-theme^="citadel-of-ak"] .tag-update,
[data-theme^="citadel-of-ak"] .tag-legal-update,
[data-theme^="citadel-of-ak"] .citadel-pill-category,
[data-theme="dark"] .update-tag,
[data-theme="dark"] .article-tag,
[data-theme="dark"] .latest-card-category,
[data-theme="dark"] .tag-case-brief,
[data-theme="dark"] .tag-checklist,
[data-theme="dark"] .tag-guide,
[data-theme="dark"] .tag-procedure,
[data-theme="dark"] .tag-update,
[data-theme="dark"] .tag-legal-update,
[data-theme="dark"] .citadel-pill-category,
.theme-citadel-active .update-tag,
.theme-citadel-active .article-tag,
.theme-citadel-active .latest-card-category,
.theme-citadel-active .tag-case-brief,
.theme-citadel-active .tag-checklist,
.theme-citadel-active .tag-guide,
.theme-citadel-active .tag-procedure,
.theme-citadel-active .tag-update,
.theme-citadel-active .tag-legal-update,
.theme-citadel-active .citadel-pill-category {
  border-color: var(--citadel-pill-category-border) !important;
  background: var(--citadel-pill-category-bg) !important;
  color: var(--citadel-pill-category-text) !important;
  box-shadow: var(--citadel-pill-category-shadow) !important;
  opacity: 1 !important;
}

/* Tag pills must share one visual language regardless of topic. */
[data-theme^="citadel-of-ak"] .insight-card-tags span,
[data-theme^="citadel-of-ak"] .insight-card-tags a,
[data-theme^="citadel-of-ak"] .article-tag-list a,
[data-theme^="citadel-of-ak"] .citadel-pill-tag,
[data-theme="dark"] .insight-card-tags span,
[data-theme="dark"] .insight-card-tags a,
[data-theme="dark"] .article-tag-list a,
[data-theme="dark"] .citadel-pill-tag,
.theme-citadel-active .insight-card-tags span,
.theme-citadel-active .insight-card-tags a,
.theme-citadel-active .article-tag-list a,
.theme-citadel-active .citadel-pill-tag {
  border-color: var(--citadel-pill-tag-border) !important;
  background: var(--citadel-pill-tag-bg) !important;
  color: var(--citadel-pill-tag-text) !important;
  box-shadow: var(--citadel-pill-tag-shadow) !important;
  opacity: 1 !important;
}

/* Technical/legal tags stay in the tag family but get more width. */
[data-theme^="citadel-of-ak"] .insight-card-tags span:nth-child(n+5),
[data-theme^="citadel-of-ak"] .insight-card-tags a:nth-child(n+5),
[data-theme="dark"] .insight-card-tags span:nth-child(n+5),
[data-theme="dark"] .insight-card-tags a:nth-child(n+5),
.theme-citadel-active .insight-card-tags span:nth-child(n+5),
.theme-citadel-active .insight-card-tags a:nth-child(n+5) {
  min-width: min(100%, 9.5rem) !important;
}

/* Meta pills remain quieter than tags and categories. */
[data-theme^="citadel-of-ak"] .article-meta span,
[data-theme^="citadel-of-ak"] .citadel-pill-meta,
[data-theme="dark"] .article-meta span,
[data-theme="dark"] .citadel-pill-meta,
.theme-citadel-active .article-meta span,
.theme-citadel-active .citadel-pill-meta {
  border-color: var(--citadel-pill-meta-border) !important;
  background: var(--citadel-pill-meta-bg) !important;
  color: var(--citadel-pill-meta-text) !important;
  box-shadow: none !important;
  opacity: 1 !important;
}

/* Filter/action pills remain visibly clickable but use one group color. */
[data-theme^="citadel-of-ak"] .insights-filter,
[data-theme^="citadel-of-ak"] .insights-page-button,
[data-theme^="citadel-of-ak"] .citadel-pill-filter,
[data-theme="dark"] .insights-filter,
[data-theme="dark"] .insights-page-button,
[data-theme="dark"] .citadel-pill-filter,
.theme-citadel-active .insights-filter,
.theme-citadel-active .insights-page-button,
.theme-citadel-active .citadel-pill-filter {
  border-color: var(--citadel-pill-filter-border) !important;
  background: var(--citadel-pill-filter-bg) !important;
  color: var(--citadel-pill-filter-text) !important;
  opacity: 1 !important;
}

[data-theme^="citadel-of-ak"] .insight-card-tags a:hover,
[data-theme^="citadel-of-ak"] .article-tag-list a:hover,
[data-theme="dark"] .insight-card-tags a:hover,
[data-theme="dark"] .article-tag-list a:hover,
.theme-citadel-active .insight-card-tags a:hover,
.theme-citadel-active .article-tag-list a:hover {
  border-color: var(--citadel-pill-category-border) !important;
  background: rgba(var(--rgb-gold), 0.16) !important;
  color: var(--citadel-pill-tag-text) !important;
}
/* END CITADEL PILL GROUP COLOR NORMALIZATION V2 */
