/* ═══════════════════════════════════════════════════════════════
   CheraghBargh Mag — Article content, comments & shared borders
   Scoped overrides loaded after the main stylesheet.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --site-border-color: #E1E1E1;
  --cb-border: var(--site-border-color);
  --cb-line: var(--site-border-color);
}

/* Soft unification for common article/comment borders */
[data-cbmag-article] .border-slate-100,
[data-cbmag-article] .border-slate-200,
#comments .border-slate-100,
#comments .border-slate-200 {
  border-color: var(--site-border-color);
}

/* ── Featured image ─────────────────────────────────────────── */
.cbmag-post-thumbnail {
  border: 0.5px solid var(--site-border-color);
  border-radius: var(--cb-radius-lg, 1rem);
  overflow: hidden;
}

.cbmag-post-thumbnail img {
  display: block;
  width: 100%;
  border-radius: inherit;
}

/* ── Home spotlight (articles + videos) ─────────────────────── */
.cbmag-spotlight__grid {
  display: grid;
  gap: 1.25rem;
}

.cbmag-spotlight__grid--split {
  grid-template-columns: 1fr;
}

.cbmag-spotlight__grid--single {
  grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
  .cbmag-spotlight__grid--split {
    grid-template-columns: 1fr 1fr;
    column-gap: 2.75rem;
    row-gap: 1.75rem;
    align-items: start;
  }
}

.cbmag-spotlight__col {
  min-width: 0;
}

.cbmag-spotlight-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.cbmag-spotlight-item__link {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
  padding: 0.55rem;
  border: 1px solid var(--cb-border, #E1E1E1);
  border-radius: var(--cb-radius-md, 12px);
  background: var(--cb-surface, #fff);
  color: inherit;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

@media (min-width: 640px) {
  .cbmag-spotlight-item__link {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 0.875rem;
    padding: 0.65rem;
  }
}

.cbmag-spotlight-item__link:hover {
  border-color: color-mix(in srgb, var(--cb-navy, #323C60) 22%, transparent);
  background: var(--cb-surface-2, #F9FAFB);
}

.cbmag-spotlight-item__media {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--cb-muted-surface, #EEF1F5);
  flex-shrink: 0;
}

.cbmag-spotlight-item__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cbmag-spotlight-item__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.cbmag-spotlight-item__placeholder svg {
  width: 58%;
  max-width: 72px;
  height: auto;
}

.cbmag-spotlight-badge {
  position: absolute;
  top: 0.35rem;
  inset-inline-start: 0.35rem;
  z-index: 1;
}

.cbmag-hot-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: rgba(207, 117, 3, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.32);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.2;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.35);
}

.cbmag-hot-icon {
  display: block;
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
}

.cbmag-hot-badge__text {
  line-height: 1.2;
}

.cbmag-spotlight-item__body {
  min-width: 0;
  padding-top: 0.1rem;
}

.cbmag-spotlight-item__title {
  margin: 0;
  color: var(--cb-text, #111827);
  font-size: 0.875rem;
  font-weight: 900;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cbmag-spotlight-item__excerpt {
  margin: 0.3rem 0 0;
  color: var(--cb-text-2, #334155);
  font-size: 0.75rem;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cbmag-spotlight-item__meta {
  margin-top: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  color: var(--cb-muted, #8A94A6);
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.5;
}

.cbmag-spotlight-item__meta span + span::before {
  content: "•";
  margin-inline-end: 0.35rem;
  color: #CBD5E1;
}

/* ── Video mosaic (home spotlight) ──────────────────────────── */
.cbmag-video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

@media (min-width: 480px) {
  .cbmag-video-grid {
    gap: 0.65rem;
  }
}

@media (min-width: 640px) {
  .cbmag-video-grid {
    gap: 0.75rem;
  }
}

.cbmag-video-tile {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--cb-radius-lg, 16px);
  background: var(--cb-muted-surface, #EEF1F5);
  text-decoration: none;
  color: #fff;
  isolation: isolate;
  cursor: pointer;
  font: inherit;
  text-align: inherit;
  appearance: none;
  -webkit-appearance: none;
}

.cbmag-video-tile--featured {
  grid-column: 1 / -1;
}

.cbmag-video-tile__media {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.cbmag-video-tile--featured .cbmag-video-tile__media {
  aspect-ratio: 2.15 / 1;
}

@media (max-width: 479.98px) {
  .cbmag-video-tile--featured .cbmag-video-tile__media {
    aspect-ratio: 2 / 1;
  }

  .cbmag-video-tile__title {
    font-size: 0.6875rem;
    line-height: 1.45;
  }

  .cbmag-video-tile__caption {
    padding: 0.45rem 0.5rem 0.5rem;
  }

  .cbmag-video-tile__play {
    width: 1.85rem;
    height: 1.85rem;
  }

  .cbmag-video-tile__play svg {
    width: 12px;
    height: 12px;
  }

  .cbmag-video-tile__badge {
    top: 0.35rem;
    inset-inline-start: 0.35rem;
    padding: 0.1rem 0.4rem;
    font-size: 9px;
  }

  .cbmag-video-tile__desc {
    display: none;
  }
}

.cbmag-video-tile__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1);
  transition: transform 0.35s ease;
}

.cbmag-video-tile__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 100%;
  background: var(--cb-muted-surface, #EEF1F5);
}

.cbmag-video-tile__placeholder svg {
  width: 42%;
  max-width: 120px;
  height: auto;
  opacity: 0.7;
}

.cbmag-video-tile__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    to top,
    rgba(15, 23, 42, 0.78) 0%,
    rgba(15, 23, 42, 0.35) 38%,
    rgba(15, 23, 42, 0.05) 62%,
    transparent 100%
  );
  transition: background 0.25s ease;
}

.cbmag-video-tile__play {
  position: absolute;
  left: 50%;
  top: 46%;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  transform: translate(-50%, -50%) scale(1);
  transition: transform 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
  pointer-events: none;
  opacity: 0.92;
}

.cbmag-video-tile--featured .cbmag-video-tile__play {
  width: 2.65rem;
  height: 2.65rem;
}

.cbmag-video-tile__badge {
  position: absolute;
  top: 0.55rem;
  inset-inline-start: 0.55rem;
  z-index: 3;
}

.cbmag-video-tile__caption {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 2;
  padding: 0.7rem 0.8rem 0.75rem;
  pointer-events: none;
}

.cbmag-video-tile--featured .cbmag-video-tile__caption {
  padding: 0.9rem 1rem 0.95rem;
}

.cbmag-video-tile__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 900;
  line-height: 1.55;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.cbmag-video-tile--featured .cbmag-video-tile__title {
  font-size: 0.9375rem;
}

.cbmag-video-tile__desc {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0.25rem 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.55;
}

@media (hover: hover) and (pointer: fine) {
  .cbmag-video-tile:hover .cbmag-video-tile__img {
    transform: scale(1.03);
  }

  .cbmag-video-tile:hover .cbmag-video-tile__overlay {
    background: linear-gradient(
      to top,
      rgba(15, 23, 42, 0.86) 0%,
      rgba(15, 23, 42, 0.42) 40%,
      rgba(15, 23, 42, 0.08) 65%,
      transparent 100%
    );
  }

  .cbmag-video-tile:hover .cbmag-video-tile__play {
    transform: translate(-50%, -50%) scale(1.06);
    background: rgba(15, 23, 42, 0.72);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cbmag-video-tile__img,
  .cbmag-video-tile__play,
  .cbmag-video-tile__overlay {
    transition: none;
  }

  .cbmag-video-tile:hover .cbmag-video-tile__img {
    transform: none;
  }
}

/* ── Video modal (lazy player) ──────────────────────────────── */
html.cbmag-video-modal-open,
body.cbmag-video-modal-open {
  overflow: hidden;
}

.cbmag-video-modal {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(0.75rem, env(safe-area-inset-top, 0px))
    max(0.75rem, env(safe-area-inset-right, 0px))
    max(0.75rem, env(safe-area-inset-bottom, 0px))
    max(0.75rem, env(safe-area-inset-left, 0px));
  background: rgba(2, 6, 23, 0.92);
  backdrop-filter: blur(2px);
}

.cbmag-video-modal__dialog {
  position: relative;
  width: min(920px, 100%);
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
}

.cbmag-video-modal__layout {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
  max-height: calc(100vh - 3.5rem);
  max-height: calc(100dvh - 3.5rem);
}

.cbmag-video-modal__close {
  position: absolute;
  top: -0.35rem;
  inset-inline-end: -0.15rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.88);
  color: #fff;
  cursor: pointer;
  transform: translateY(-100%);
}

@media (min-width: 640px) {
  .cbmag-video-modal__close {
    top: 0.65rem;
    inset-inline-end: 0.65rem;
    transform: none;
    background: rgba(15, 23, 42, 0.72);
  }
}

.cbmag-video-modal__frame {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: min(56.25vw, calc(100dvh - 11rem));
  overflow: hidden;
  border-radius: var(--cb-radius-lg, 16px);
  background: #020617;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.cbmag-video-modal__info {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.875rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--cb-radius-lg, 16px);
  background: transparent;
  color: #fff;
  direction: rtl;
  text-align: right;
}

.cbmag-video-modal__info-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.45;
  color: #fff;
}

.cbmag-video-modal__info-desc {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.8);
  overflow-y: auto;
  min-height: 0;
  flex: 1 1 auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

.cbmag-video-modal__info-desc::-webkit-scrollbar {
  width: 4px;
}

.cbmag-video-modal__info-desc::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 4px;
}

@media (min-width: 768px) {
  .cbmag-video-modal__dialog {
    width: min(1040px, 100%);
  }

  .cbmag-video-modal__layout {
    flex-direction: row;
    align-items: flex-end;
    gap: 1rem;
    max-height: calc(100vh - 2.5rem);
    max-height: calc(100dvh - 2.5rem);
    container-type: inline-size;
  }

  .cbmag-video-modal__frame {
    flex: 1.65 1 0;
    min-width: 0;
    max-height: none;
    aspect-ratio: 16 / 9;
    align-self: flex-end;
  }

  .cbmag-video-modal__info {
    flex: 0 1 auto;
    min-width: 0;
    min-height: 0;
    max-width: 22rem;
    height: auto;
    align-self: flex-end;
    padding: 1.125rem 1.25rem;
    max-height: calc((100cqw - 1rem) * 1.65 / 2.65 * 9 / 16);
    overflow-y: auto;
  }

  .cbmag-video-modal__info-desc {
    overflow-y: visible;
    flex: 0 1 auto;
    min-height: 0;
  }
}

.cbmag-video-modal__iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.cbmag-video-modal__video {
  object-fit: contain;
  background: #000;
}

/* ── Single article post meta (author · date · reading time) ─── */
/* Mobile only: keep one compact line; tablet/desktop keep Tailwind utilities */
@media (max-width: 767.98px) {
  .cbmag-post-meta {
    flex-wrap: nowrap;
    gap: 0.25rem; /* 4px — was gap-3 / 12px */
    font-size: clamp(0.75rem, 3.2vw, 0.8125rem); /* 12px–13px */
    line-height: 1.4;
  }

  .cbmag-post-meta__sep {
    margin-inline: -0.05em;
    padding: 0;
    flex-shrink: 0;
  }

  .cbmag-post-meta > span,
  .cbmag-post-meta > time {
    white-space: nowrap;
  }
}

@media (max-width: 359.98px) {
  .cbmag-post-meta {
    gap: 0.1875rem; /* 3px */
    font-size: 0.71875rem; /* 11.5px — last resort for very narrow viewports */
    line-height: 1.35;
  }
}

/* ── Comments spacing & logged-in notice ────────────────────── */
:root {
  --cbmag-header-height: 72px;
  --cbmag-sticky-offset: calc(var(--cbmag-header-height) + 1rem);
  --cbmag-action-bar-sticky-top: calc(var(--cbmag-header-height) + 1.25rem + 100px);
}

#comments,
#cbmag-faq {
  scroll-margin-top: var(--cbmag-sticky-offset);
}

#comments > h2 {
  margin-bottom: 1.75rem;
}

@media (min-width: 768px) {
  #comments > h2 {
    margin-bottom: 2.25rem;
  }
}

/* Comment avatar ring — fixed #F6A22C in light and dark (no theme vars). */
.cbmag-comment-avatar {
  --tw-ring-color: #F6A22C;
}

html[data-theme="dark"] .cbmag-comment-avatar {
  --tw-ring-color: #F6A22C;
}

#comments .logged-in-as {
  display: none;
}

/* Space between last comment list and comment form title (#respond) */
#comments .cbmag-comment-list ~ #respond {
  margin-top: 28px;
}

@media (min-width: 768px) {
  #comments .cbmag-comment-list ~ #respond {
    margin-top: 40px;
  }
}

/* Reply title: space between author name and “لغو” (WP wraps cancel in <small>) */
#reply-title small {
  display: inline-block;
  margin-inline-start: 8px;
  font-weight: 700;
  max-width: 100%;
  vertical-align: baseline;
}

#cancel-comment-reply-link {
  color: var(--cb-navy, #323C60);
  text-decoration: none;
  white-space: nowrap;
}

#cancel-comment-reply-link:hover,
#cancel-comment-reply-link:focus-visible {
  text-decoration: underline;
  outline: none;
}

#cancel-comment-reply-link:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--cb-orange, #F6A033) 75%, transparent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Single post: desktop action rail ─────────────────────────── */
.cbmag-single-layout {
  --cbmag-single-gap: 2rem; /* matches Tailwind lg:gap-8 */
  --cbmag-single-grid-width: calc(780px + var(--cbmag-single-gap) + 300px);
}

@media (min-width: 1024px) {
  .cbmag-single-layout {
    position: relative;
    overflow: visible;
  }

  .cbmag-single-layout__grid {
    overflow: visible;
  }

  .cbmag-single-layout__article-col {
    min-width: 0;
    overflow: visible;
  }

  /*
   * Floating rail — outside article card, aligned to article column edge.
   * Spans full layout height (article + sidebar) for sticky boundary.
   */
  .cbmag-article-actions-rail {
    position: absolute;
    top: 0;
    bottom: 0;
    right: calc(max(0px, (100% - var(--cbmag-single-grid-width)) / 2) - var(--cbmag-single-gap) - 3rem);
    width: 3rem;
    z-index: 2;
    pointer-events: none;
  }

  .cbmag-article-actions {
    height: 100%;
    pointer-events: auto;
  }

  .cbmag-article-actions__bar {
    position: sticky;
    top: 112px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 3rem;
  }

  .cbmag-article-actions__btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 2.75rem;
    min-height: 2.75rem;
    padding: 0.35rem 0.25rem;
    margin: 0;
    border: 1px solid var(--site-border-color, #e2e8f0);
    border-radius: 0.85rem;
    background: #fff;
    color: var(--cb-text-2, #334155);
    font-family: inherit;
    font-size: 0.625rem;
    font-weight: 600;
    line-height: 1.1;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  }

  .cbmag-article-actions__btn:hover,
  .cbmag-article-actions__btn:focus-visible {
    border-color: color-mix(in srgb, var(--cb-navy, #323c60) 25%, #e2e8f0);
    background: var(--cb-muted-surface, #eef1f5);
    color: var(--cb-navy, #323c60);
    outline: none;
  }

  .cbmag-article-actions__icon {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
  }

  .cbmag-article-actions__count,
  .cbmag-article-actions__label {
    font-family: inherit;
    font-size: 0.625rem;
    font-weight: 600;
    line-height: 1;
  }

  .cbmag-article-actions__share {
    position: relative;
  }

  .cbmag-article-actions__popover {
    position: absolute;
    inset-inline-start: calc(100% + 0.5rem);
    top: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    min-width: 9.5rem;
    padding: 0.35rem;
    border: 1px solid var(--site-border-color, #e2e8f0);
    border-radius: 0.85rem;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  }

  .cbmag-article-actions__popover[hidden] {
    display: none !important;
  }

  .cbmag-article-actions__share-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.45rem 0.55rem;
    border: 0;
    border-radius: 0.55rem;
    background: transparent;
    color: var(--cb-text, #111827);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
  }

  .cbmag-article-actions__share-icon {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
  }

  .cbmag-article-actions__share-icon svg {
    display: block;
    max-width: 100%;
    max-height: 100%;
  }

  .cbmag-article-actions__share-link:hover,
  .cbmag-article-actions__share-link:focus-visible {
    background: var(--cb-muted-surface, #eef1f5);
    color: var(--cb-navy, #323c60);
    outline: none;
  }
}

/* ── Single post: mobile sticky action dock ─────────────────── */
@media (max-width: 1023px) {
  body.single-post,
  body.single {
    padding-bottom: calc(5.75rem + env(safe-area-inset-bottom, 0px));
  }

  .cbmag-article-actions-mobile {
    position: fixed;
    z-index: 95;
    left: 50%;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    width: max-content;
    max-width: calc(100vw - 24px);
    pointer-events: none;
  }

  .cbmag-article-actions--mobile {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 0.4rem 0.55rem;
    border: 1px solid var(--site-border-color, #e2e8f0);
    border-radius: 1.15rem;
    background: color-mix(in srgb, #fff 92%, transparent);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    pointer-events: auto;
  }

  .cbmag-article-actions--mobile .cbmag-article-actions__btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 3.1rem;
    min-width: 3.1rem;
    min-height: 3.1rem;
    padding: 0.4rem 0.25rem;
    margin: 0;
    border: 1px solid transparent;
    border-radius: 0.85rem;
    background: transparent;
    color: var(--cb-text-2, #334155);
    font-family: inherit;
    font-size: 0.625rem;
    font-weight: 600;
    line-height: 1.1;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .cbmag-article-actions--mobile .cbmag-article-actions__btn:hover,
  .cbmag-article-actions--mobile .cbmag-article-actions__btn:focus-visible {
    background: var(--cb-muted-surface, #eef1f5);
    color: var(--cb-navy, #323c60);
    outline: none;
  }

  .cbmag-article-actions--mobile .cbmag-article-actions__icon {
    width: 1.2rem;
    height: 1.2rem;
    flex-shrink: 0;
  }

  .cbmag-article-actions--mobile .cbmag-article-actions__count,
  .cbmag-article-actions--mobile .cbmag-article-actions__label {
    font-family: inherit;
    font-size: 0.625rem;
    font-weight: 600;
    line-height: 1;
  }

  .cbmag-article-actions--mobile .cbmag-article-actions__share {
    position: relative;
  }

  .cbmag-article-actions--mobile .cbmag-article-actions__popover,
  .cbmag-article-actions__popover--mobile {
    position: absolute;
    left: 50%;
    right: auto;
    top: auto;
    bottom: calc(100% + 0.45rem);
    z-index: 6;
    display: flex;
    flex-direction: column;
    min-width: 9.5rem;
    padding: 0.35rem;
    border: 1px solid var(--site-border-color, #e2e8f0);
    border-radius: 0.85rem;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    transform: translateX(-50%);
  }

  .cbmag-article-actions--mobile .cbmag-article-actions__popover[hidden] {
    display: none !important;
  }

  .cbmag-article-actions--mobile .cbmag-article-actions__share-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.55rem;
    border: 0;
    border-radius: 0.55rem;
    background: transparent;
    color: var(--cb-text, #111827);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: inherit;
    text-decoration: none;
    cursor: pointer;
  }

  .cbmag-article-actions--mobile .cbmag-article-actions__share-icon {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
  }

  .cbmag-article-actions--mobile .cbmag-article-actions__share-icon svg {
    display: block;
    max-width: 100%;
    max-height: 100%;
  }

  .cbmag-article-actions--mobile .cbmag-article-actions__share-link:hover,
  .cbmag-article-actions--mobile .cbmag-article-actions__share-link:focus-visible {
    background: var(--cb-muted-surface, #eef1f5);
    color: var(--cb-navy, #323c60);
    outline: none;
  }
}

/* Comment Ajax toast */
#cbmag-toast.is-visible {
  white-space: normal;
  text-align: center;
  max-width: min(92vw, 28rem);
  line-height: 1.55;
}

@media (max-width: 767px) {
  #cbmag-toast.is-visible {
    width: calc(100% - 32px);
    max-width: none;
    left: 50%;
    right: auto;
    top: calc(14px + env(safe-area-inset-top, 0px));
    bottom: auto;
    margin-left: 0;
    margin-right: 0;
    padding: 0.55rem 0.85rem;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.45;
    border-radius: 0.85rem;
    box-sizing: border-box;
  }
}

/* ── Single post: related articles (mobile simplification) ─── */
@media (max-width: 1023px) {
  .cbmag-related-posts .cbmag-card__reading-time {
    display: none;
  }

  .cbmag-related-posts .cbmag-card__meta {
    justify-content: flex-start;
    padding: 0 0.75rem 0.75rem;
  }

  .cbmag-related-posts .cbmag-card__content {
    padding: 0.75rem 0.75rem 0.5rem;
  }

  .cbmag-related-posts .cbmag-card__title {
    line-height: 1.5;
  }
}

/* ── Single post: comment submit (mobile) ───────────────────── */
@media (max-width: 1023px) {
  #comments #respond .form-submit {
    display: block;
    width: 100%;
    margin-top: 0.75rem;
  }

  #cbmag-comment-submit,
  #comments #respond .form-submit .cbmag-comment-submit,
  #comments #respond .form-submit input[type="submit"],
  #comments #respond .form-submit .submit {
    display: flex;
    width: 100%;
    justify-content: center;
    border-radius: 0.75rem;
    font-family: inherit;
    font-weight: 700;
  }
}

.cbmag-scroll-flash {
  animation: cbmag-scroll-flash 1.2s ease;
}

@keyframes cbmag-scroll-flash {
  0%,
  100% {
    box-shadow: none;
  }

  20%,
  55% {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--cb-orange, #f6a033) 28%, transparent);
  }
}

/* ── Footer: short description text alignment ─────────────── */
.cbmag-footer-mobile__description {
  display: block;
  width: 100%;
  direction: rtl;
  text-align: justify !important;
  text-justify: inter-word;
  text-align-last: right;
}

.cbmag-footer__desc {
  direction: rtl;
  text-align: right;
  text-align-last: right;
}

@media (min-width: 1024px) {
  .cbmag-footer__desc {
    text-align: justify;
    text-justify: inter-word;
    text-align-last: right;
  }
}

/* ── Search pill: soft input + circular icon that forms the input edge ─ */
.cbmag-search-pill,
form:has(> .cbmag-search-input),
.cbmag-branded-search {
  --cbmag-search-bg: #ffffff;
  --cbmag-search-text: #0F172A;
  --cbmag-search-placeholder: #94A3B8;
  --cbmag-search-icon-bg: #F2F3F5;
  --cbmag-search-icon: #26365f;
  --cbmag-search-icon-border: #EFEFEF;
  --cbmag-search-shadow:
    inset 0 3px 3px rgba(0, 0, 0, 0.1),
    inset 0 -1px 2px rgba(255, 255, 255, 0.9),
    0 1px 3px 0 rgba(255, 255, 255, 1);
  --cbmag-search-btn-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.95),
    0 1px 2px 0.5px rgba(0, 0, 0, 0.1);
  position: relative;
  margin: 0;
  min-width: 0;
  width: 100%;
}

.cbmag-search-input,
.cbmag-branded-search__input,
.cbmag-search-pill__input {
  width: 100%;
  height: 52px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  border: 0 !important;
  border-radius: 25px !important;
  background: var(--cbmag-search-bg) !important;
  box-shadow: var(--cbmag-search-shadow) !important;
  color: var(--cbmag-search-text) !important;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.25rem;
  text-align: right;
  padding: 0 62px 0 1rem !important;
  outline: none !important;
}

.cbmag-branded-search_size_desktop .cbmag-branded-search__input,
.cbmag-search-pill--desktop .cbmag-search-pill__input,
.cbmag-search-pill--desktop .cbmag-search-input {
  height: 44px;
  padding-inline-end: 52px !important;
  font-size: 0.8125rem;
  border-radius: 22px !important;
}

.cbmag-search-input::placeholder,
.cbmag-branded-search__input::placeholder,
.cbmag-search-pill__input::placeholder {
  color: var(--cbmag-search-placeholder) !important;
  font-weight: 300 !important;
  opacity: 1;
}

.cbmag-search-input::-webkit-search-decoration,
.cbmag-search-input::-webkit-search-cancel-button,
.cbmag-branded-search__input::-webkit-search-decoration,
.cbmag-branded-search__input::-webkit-search-cancel-button,
.cbmag-search-pill__input::-webkit-search-decoration,
.cbmag-search-pill__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.cbmag-search-input:focus,
.cbmag-branded-search__input:focus,
.cbmag-search-pill__input:focus {
  outline: none !important;
  box-shadow: var(--cbmag-search-shadow) !important;
}

/* Circular icon button = right rounded end of the search input */
.cbmag-search-btn,
.cbmag-branded-search__btn,
.cbmag-search-pill__btn {
  position: absolute !important;
  top: 0 !important;
  right: 0 !important;
  left: auto !important;
  z-index: 2;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 52px !important;
  height: 52px !important;
  margin: 0;
  padding: 0;
  border: 1px solid var(--cbmag-search-icon-border) !important;
  border-radius: 9999px !important;
  background: var(--cbmag-search-icon-bg) !important;
  background-color: var(--cbmag-search-icon-bg) !important;
  color: var(--cbmag-search-icon) !important;
  box-shadow: var(--cbmag-search-btn-shadow) !important;
  transform: none;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    transform 0.12s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.cbmag-search-btn svg,
.cbmag-branded-search__btn svg,
.cbmag-search-pill__btn svg {
  display: block;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  stroke-width: 2.5;
}

.cbmag-branded-search_size_desktop .cbmag-branded-search__btn,
.cbmag-search-pill--desktop .cbmag-search-btn,
.cbmag-search-pill--desktop .cbmag-search-pill__btn {
  width: 44px !important;
  height: 44px !important;
}

.cbmag-branded-search_size_desktop .cbmag-branded-search__btn svg,
.cbmag-search-pill--desktop .cbmag-search-btn svg,
.cbmag-search-pill--desktop .cbmag-search-pill__btn svg {
  width: 24px;
  height: 24px;
}

.cbmag-search-btn:hover,
.cbmag-branded-search__btn:hover,
.cbmag-search-pill__btn:hover {
  background: #EBEDF0 !important;
  background-color: #EBEDF0 !important;
  color: var(--cbmag-search-icon) !important;
  border-color: #E8E8E8 !important;
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.98),
    0 1px 2px 0.5px rgba(0, 0, 0, 0.12) !important;
}

.cbmag-search-btn:focus-visible,
.cbmag-branded-search__btn:focus-visible,
.cbmag-search-pill__btn:focus-visible {
  outline: 2px solid color-mix(in srgb, #26365f 55%, transparent);
  outline-offset: 2px;
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.95),
    0 1px 2px 0.5px rgba(0, 0, 0, 0.1) !important;
}

.cbmag-search-btn:active,
.cbmag-branded-search__btn:active,
.cbmag-search-pill__btn:active {
  background: #E6E8EC !important;
  background-color: #E6E8EC !important;
  color: var(--cbmag-search-icon) !important;
  border-color: #E5E5E5 !important;
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.08),
    inset 0 1px 1px rgba(255, 255, 255, 0.65) !important;
  transform: translateY(1px);
}

/* Hide legacy branded overlay — use real thin placeholder text */
.cbmag-branded-search__overlay {
  display: none !important;
}

/* ── Live search dropdown ───────────────────────────────────── */
.cbmag-live-search-host {
  position: relative;
  z-index: 1;
}

.cbmag-live-search-host.is-open {
  z-index: 260;
}

/* Fixed-to-viewport panel (position/size set in JS) — escapes mobile stacking */
.cbmag-live-search {
  position: fixed;
  z-index: 10000;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #E2E8F0;
  border-radius: 1rem;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
  text-align: right;
  /* Avoid iOS creating a lower compositing layer than hero captions */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.cbmag-live-search__list {
  margin: 0;
  padding: 0.35rem;
  list-style: none;
}

.cbmag-live-search__item {
  display: block;
  padding: 0.7rem 0.85rem;
  border-radius: 0.75rem;
  color: #0F172A;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.5;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.cbmag-live-search__item:hover,
.cbmag-live-search__item:focus-visible {
  background: #F1F5F9;
  color: #26365f;
  outline: none;
}

.cbmag-live-search__status {
  padding: 0.9rem 1rem;
  color: #64748B;
  font-size: 0.8125rem;
  font-weight: 600;
}

.cbmag-live-search__all {
  display: block;
  border-top: 1px solid #E2E8F0;
  padding: 0.75rem 1rem;
  color: #26365f;
  font-size: 0.8125rem;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.cbmag-live-search__all:hover,
.cbmag-live-search__all:focus-visible {
  background: #F8FAFC;
  outline: none;
}

/* ── Home category tabs: mobile edge fade (RTL continues left) ─ */
@media (max-width: 1023.98px) {
  .cbmag-tabs-scroll {
    align-items: center;
    padding-block: 0.375rem;
    overflow-y: hidden;
    /* Right (inline-start in RTL): soft start; left: stronger fade = more items */
    padding-inline-start: 0.35rem;
    padding-inline-end: 0;
    -webkit-mask-image: linear-gradient(
      to right,
      transparent 0,
      #000 32px,
      #000 calc(100% - 18px),
      transparent 100%
    );
    mask-image: linear-gradient(
      to right,
      transparent 0,
      #000 32px,
      #000 calc(100% - 18px),
      transparent 100%
    );
  }
}

/* ── Article content (scoped) ───────────────────────────────── */
.cbmag-prose.entry-content {
  color: var(--cb-text-2, #334155);
  line-height: 2.1;
  overflow-x: clip;
}

/* Headings */
.cbmag-prose.entry-content h2 {
  margin: 2rem 0 0.85rem;
  padding-inline-start: 0.75rem;
  border-inline-start: 3px solid var(--cb-orange, #F6A033);
  color: var(--cb-navy, #323C60);
  font-size: 1.25rem;
  line-height: 1.7;
  font-weight: 900;
}

.cbmag-prose.entry-content h3 {
  margin: 1.65rem 0 0.7rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--site-border-color);
  color: var(--cb-navy, #323C60);
  font-size: 1.1rem;
  line-height: 1.75;
  font-weight: 900;
}

.cbmag-prose.entry-content h4 {
  margin: 1.35rem 0 0.55rem;
  padding-inline-start: 0.65rem;
  color: var(--cb-text, #111827);
  font-size: 1rem;
  line-height: 1.8;
  font-weight: 800;
  position: relative;
}

.cbmag-prose.entry-content h4::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0.35em;
  bottom: 0.35em;
  width: 2px;
  border-radius: 2px;
  background: var(--cb-orange, #F6A033);
}

/* Lists */
.cbmag-prose.entry-content ul,
.cbmag-prose.entry-content ol {
  margin: 0 0 1.15rem;
  padding-inline-start: 1.4rem;
  padding-inline-end: 0;
  line-height: 2.05;
}

.cbmag-prose.entry-content ul {
  list-style: disc;
}

.cbmag-prose.entry-content ol {
  list-style: decimal;
}

.cbmag-prose.entry-content li {
  margin-bottom: 0.45rem;
  padding-inline-start: 0.15rem;
}

.cbmag-prose.entry-content li > ul,
.cbmag-prose.entry-content li > ol {
  margin: 0.4rem 0 0.15rem;
}

.cbmag-prose.entry-content ul ::marker {
  color: var(--cb-orange, #F6A033);
}

.cbmag-prose.entry-content ol ::marker {
  color: var(--cb-navy, #323C60);
  font-weight: 800;
}

/* Tables */
.cbmag-prose.entry-content .cbmag-table-scroll,
.cbmag-prose.entry-content .wp-block-table,
.cbmag-prose.entry-content figure.wp-block-table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
  border: 1px solid var(--site-border-color);
  border-radius: var(--cb-radius-md, 12px);
  background: #fff;
}

.cbmag-prose.entry-content .wp-block-table table,
.cbmag-prose.entry-content figure.wp-block-table table,
.cbmag-prose.entry-content .cbmag-table-scroll table {
  margin: 0;
  border: 0;
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--cb-text-2, #334155);
}

.cbmag-prose.entry-content th,
.cbmag-prose.entry-content td {
  border: 1px solid var(--site-border-color);
  padding: 0.7rem 0.9rem;
  text-align: start;
  vertical-align: top;
}

.cbmag-prose.entry-content thead th,
.cbmag-prose.entry-content tr:first-child > th {
  background: var(--cb-navy, #323C60);
  color: #fff;
  font-weight: 800;
  border-color: color-mix(in srgb, var(--cb-navy, #323C60) 88%, #000);
}

.cbmag-prose.entry-content tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--cb-soft, #F2F3F5) 72%, #fff);
}

.cbmag-prose.entry-content tbody tr:hover td {
  background: color-mix(in srgb, var(--cb-orange, #F6A033) 12%, #fff);
}

/* ── Table of contents ──────────────────────────────────────── */
.cbmag-toc-box {
  border: 1px solid var(--site-border-color, #E1E1E1);
  border-radius: 16px;
  background: #fff;
  padding: 0.85rem 1rem;
}

.cbmag-toc-summary {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  list-style: none;
  color: var(--cb-text, #111827);
  font-size: 0.9rem;
  font-weight: 900;
}

.cbmag-toc-summary::-webkit-details-marker {
  display: none;
}

.cbmag-toc-summary__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cb-navy, #323C60) 8%, #fff);
  color: var(--cb-navy, #323C60);
}

.cbmag-toc-heading {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.85rem;
  color: var(--cb-text, #111827);
  font-size: 0.95rem;
  font-weight: 950;
}

.cbmag-toc-list {
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cbmag-toc-desktop {
  padding: 0.9rem;
}

.cbmag-toc-desktop .cbmag-toc-heading {
  margin-bottom: 0.65rem;
  gap: 0.45rem;
  font-size: 0.875rem;
}

.cbmag-toc-desktop .cbmag-toc-summary__icon {
  width: 26px;
  height: 26px;
}

.cbmag-toc-desktop .cbmag-toc-summary__icon svg {
  width: 15px;
  height: 15px;
}

.cbmag-toc-desktop .cbmag-toc-list {
  margin-top: 0;
  gap: 0.3rem;
}

.cbmag-toc-link {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  width: 100%;
  padding: 0.7rem 0.75rem;
  border-radius: 12px;
  color: #475569;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.7;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.cbmag-toc-desktop .cbmag-toc-link {
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.55;
}

.cbmag-toc-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.45rem;
  height: 1.45rem;
  margin-top: 0.1rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cb-soft, #F2F3F5) 90%, #fff);
  color: var(--cb-navy, #323C60);
  font-size: 0.75rem;
  font-weight: 900;
  line-height: 1;
  flex-shrink: 0;
}

.cbmag-toc-desktop .cbmag-toc-num {
  min-width: 1.2rem;
  height: 1.2rem;
  margin-top: 0.05rem;
  font-size: 0.6875rem;
}

.cbmag-toc-text {
  flex: 1;
  min-width: 0;
}

.cbmag-toc-link:hover {
  background: color-mix(in srgb, var(--cb-navy, #323C60) 6%, #fff);
  color: var(--cb-navy, #323C60);
}

.cbmag-toc-link.is-active {
  background: color-mix(in srgb, var(--cb-navy, #323C60) 12%, #fff);
  color: var(--cb-navy, #323C60);
  font-weight: 900;
}

.cbmag-toc-link.is-active .cbmag-toc-num {
  background: var(--cb-navy, #323C60);
  color: #fff;
}

@media (min-width: 768px) {
  .cbmag-toc-mobile .cbmag-toc-list {
    gap: 0.45rem;
  }
}

/* ── Sidebar categories (single / archive) ──────────────────── */
.cbmag-sidebar-cats__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.cbmag-sidebar-cat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  color: #475569;
  font-size: 0.875rem;
  font-weight: 800;
  line-height: 1.5;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.cbmag-sidebar-cat__count {
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.cbmag-sidebar-cat:hover {
  background: color-mix(in srgb, var(--cb-navy, #323C60) 10%, #fff);
  color: var(--cb-navy, #323C60);
}

.cbmag-sidebar-cat:hover .cbmag-sidebar-cat__count {
  color: var(--cb-navy, #323C60);
}

.cbmag-sidebar-cat.is-active {
  background: color-mix(in srgb, var(--cb-navy, #323C60) 12%, #fff);
  color: var(--cb-navy, #323C60);
  font-weight: 900;
}

.cbmag-sidebar-cat.is-active .cbmag-sidebar-cat__count {
  color: var(--cb-navy, #323C60);
  opacity: 0.75;
}

/* ── Vanilla JS helpers (post-Alpine) ───────────────────────── */
.cbmag-deferred-grid:not(.is-ready) .cbmag-deferred-grid__live {
  display: none !important;
}

.cbmag-deferred-grid.is-ready .cbmag-deferred-grid__skeleton {
  display: none !important;
}

.cbmag-faq__icon.rotate-45 {
  transform: rotate(45deg);
}

[data-cbmag-collapse-icon].rotate-180 {
  transform: rotate(180deg);
}

