/* ==========================================================================
   Ignite™ — Article Panel + Action Bar
   ========================================================================== */

/* ── Action bar — card context ──────────────────────────────────────────── */
.ignite-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 12px 10px;
  border-top: 1px solid rgba(0,0,0,.06);
}
body.bb-dark-mode .ignite-actions { border-top-color: rgba(255,255,255,.06); }

.ignite-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border: none;
  background: none;
  cursor: pointer;
  color: #a800ff;
  opacity: .55;
  font-family: inherit;
  font-size: .72rem;
  font-weight: 600;
  border-radius: 4px;
  transition: opacity .18s, color .18s, background .18s;
  white-space: nowrap;
  line-height: 1;
  text-decoration: none;
}
.ignite-action:hover { opacity: 1; background: rgba(0,0,0,.05); }
body.bb-dark-mode .ignite-action:hover { background: rgba(255,255,255,.08); }



/* Like — active state */
.ignite-action--like[aria-pressed="true"] {
  color: #a800ff;
  opacity: 1;
}
.ignite-action--like[aria-pressed="true"] svg {
  fill: #a800ff;
  stroke: #a800ff;
}

/* Save — active state */
.ignite-action--save[aria-pressed="true"] {
  color: #f59e0b;
  opacity: 1;
}
.ignite-action--save[aria-pressed="true"] svg {
  fill: #f59e0b;
  stroke: #f59e0b;
}

/* Subscribe — active state */
.ignite-action--subscribe[aria-pressed="true"] {
  color: #7b5cf0;
  opacity: 1;
}

.ignite-action__icon { display: flex; align-items: center; flex-shrink: 0; }
.ignite-action__count { font-size: .68rem; font-weight: 600; min-width: 10px; }
.ignite-action__label { font-size: .7rem; font-weight: 500; }

/* Share copied feedback */
.ignite-action--share.copied .ignite-action__icon::after {
  content: '✓';
  font-size: .7rem;
  margin-left: 2px;
  color: var(--ig-accent, #00ffc8);
}

/* ── Panel context — larger, labeled ────────────────────────────────────── */
.ignite-actions--panel {
  padding: 12px 0;
  gap: 4px;
  border-top: 1px solid rgba(0,0,0,.07);
  border-bottom: 1px solid rgba(0,0,0,.07);
  margin: 12px 0;
}
body.bb-dark-mode .ignite-actions--panel {
  border-color: rgba(255,255,255,.07);
}
.ignite-actions--panel .ignite-action {
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  font-size: .65rem;
  flex: 1;
  justify-content: center;
}
/* Like count always stays inline to the right of the icon */
.ignite-action--like {
  flex-direction: row !important;
  gap: 4px !important;
  align-items: center;
}
.ignite-actions--panel .ignite-action__icon svg { width: 20px; height: 20px; }
.ignite-actions--panel .ignite-action__count { font-size: .72rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   Slide-in article panel
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Backdrop ────────────────────────────────────────────────────────────── */
.ignite-panel__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 1099;
  opacity: 0;
  transition: opacity .28s ease;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.ignite-panel__backdrop.visible { opacity: 1; }
.ignite-panel__backdrop[hidden] { display: none; }

/* ── Panel shell ─────────────────────────────────────────────────────────── */
.ignite-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: min(860px, 62vw);
  z-index: 1100;
  background: #fff;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .32s cubic-bezier(.4,0,.2,1);
  box-shadow: -4px 0 32px rgba(0,0,0,.18);
  overscroll-behavior: none;
  touch-action: pan-y;
}
.ignite-panel[hidden] { display: none; }
.ignite-panel.open    { transform: translateX(0); }

body.bb-dark-mode .ignite-panel { background: var(--bb-content-bg, #1a1a1a); }

/* ── Panel header (sticky) ───────────────────────────────────────────────── */
.ignite-panel__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0,0,0,.07);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  background: inherit;
  z-index: 10;
}
body.bb-dark-mode .ignite-panel__header { border-bottom-color: rgba(255,255,255,.07); }

/* ── Floating back button — same as filtered results (that one works) ──────── */
.ignite-panel__back {
  position: fixed;
  right: 16px;
  top: 50vh;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(100,100,100,.55);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  z-index: 1110;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  transition: background .18s, transform .18s;
  flex-shrink: 0;
}
.ignite-panel__back:hover {
  background: rgba(80,80,80,.75);
  transform: translateY(-50%) scale(1.06);
  color: #fff;
}
.ignite-panel__back svg {
  width: 37px;
  height: 37px;
  stroke-width: 2;
  margin-right: 2px;
}

/* ── Panel body ──────────────────────────────────────────────────────────── */
.ignite-panel__body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;        /* no horizontal drift */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; /* no rubber-band revealing bg */
  touch-action: pan-y;          /* vertical scroll only */
}

/* ── Loading spinner — centered at bottom of top third (33vh) ────────────── */
.ignite-panel__loading {
  display: flex;
  align-items: flex-end;      /* bottom of the container */
  justify-content: center;
  height: 33vh;               /* top third of screen */
  padding-bottom: 16px;
}
.ignite-panel__spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(0,0,0,.1);
  border-top-color: #a800ff;
  border-radius: 50%;
  animation: igSpin .7s linear infinite;
}
body.bb-dark-mode .ignite-panel__spinner { border-color: rgba(255,255,255,.1); border-top-color: #a800ff; }

@keyframes igSpin { to { transform: rotate(360deg); } }

/* ── Hero image ──────────────────────────────────────────────────────────── */
.ignite-panel__hero {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #e8e8e8;
}
.ignite-panel__hero img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}

/* ── Video / embed sizing — never override author's intended size ────────── */
/*
 * VideoPress and video blocks set their own width via theme CSS / Additional CSS.
 * The panel sets nothing on these elements — your Additional CSS wins completely.
 */
.ignite-panel__body-content iframe,
.ignite-panel__body-content video,
.ignite-panel__body-content .wp-block-video,
.ignite-panel__body-content .wp-block-jetpack-videopress,
.ignite-panel__body-content .wp-block-embed,
.ignite-panel__body-content .wp-block-embed__wrapper {
  all: revert; /* strip any panel-inherited sizing — let theme CSS take over */
}

/* Fullscreen: ensure VideoPress can go fullscreen without panel interference */
.ignite-panel__body-content :fullscreen,
.ignite-panel__body-content :-webkit-full-screen,
.ignite-panel__body-content :-moz-full-screen {
  max-width: 100vw !important;
  width: 100vw !important;
  height: 100vh !important;
}

/* ── Article content ─────────────────────────────────────────────────────── */
.ignite-panel__article {
  padding: 20px 20px 40px;
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.ignite-panel__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.ignite-panel__title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 10px;
}

.ignite-panel__byline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: .78rem;
  opacity: .65;
}
.ignite-panel__byline img {
  width: 24px; height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.ignite-panel__body-content {
  font-size: 1rem;
  line-height: 1.75;
  margin: 16px 0;
}
/* Only style standalone images — not images inside columns, grids, or custom layouts */
.ignite-panel__body-content > p img,
.ignite-panel__body-content > figure img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 12px 0;
}
/* Do NOT constrain images inside column blocks or custom wrappers */
.ignite-panel__body-content .wp-block-columns img,
.ignite-panel__body-content .wp-block-column img,
.ignite-panel__body-content [class*="column"] img,
.ignite-panel__body-content [class*="grid"] img {
  max-width: 100%;
  height: auto;
  /* no forced margin — let the column layout control spacing */
}
/* Preserve Gutenberg column layouts exactly as authored */
/* Columns: respect Gutenberg's own stacking logic */
.ignite-panel__body-content .wp-block-columns {
  display: flex;
  gap: 2em;
}
/* Only force nowrap when explicitly set to not stack */
.ignite-panel__body-content .wp-block-columns.is-not-stacked-on-mobile {
  flex-wrap: nowrap !important;
}
/* Allow natural stacking for columns without the override class */
.ignite-panel__body-content .wp-block-columns:not(.is-not-stacked-on-mobile) {
  flex-wrap: wrap;
}
.ignite-panel__body-content .wp-block-column {
  flex: 1;
  min-width: 0;
}
/* Respect any custom column/layout classes — don't override their widths */
.ignite-panel__body-content [class*="column"],
.ignite-panel__body-content [class*="col-"],
.ignite-panel__body-content [class*="grid"] {
  box-sizing: border-box;
}
.ignite-panel__body-content h2 { font-size: 1.2rem; font-weight: 700; margin: 24px 0 10px; }
.ignite-panel__body-content h3 { font-size: 1.05rem; font-weight: 700; margin: 20px 0 8px; }
.ignite-panel__body-content p  { margin: 0 0 14px; }
.ignite-panel__body-content ul,
.ignite-panel__body-content ol { padding-left: 24px; margin: 0 0 14px; }
.ignite-panel__body-content li { margin-bottom: 6px; }
.ignite-panel__body-content a  { color: var(--ig-accent, #00ffc8); }
.ignite-panel__body-content blockquote {
  border-left: 3px solid var(--ig-accent, #00ffc8);
  margin: 16px 0;
  padding: 8px 16px;
  opacity: .8;
  font-style: italic;
}

/* ── Panel tags ──────────────────────────────────────────────────────────── */
.ignite-panel__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0;
}

/* ── Comments ────────────────────────────────────────────────────────────── */
.ignite-panel__comments {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(0,0,0,.07);
}
body.bb-dark-mode .ignite-panel__comments { border-top-color: rgba(255,255,255,.07); }

.ignite-panel__comments-heading {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 16px;
}

.ignite-panel__comment {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.ignite-panel__comment-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.ignite-panel__comment-body { flex: 1; }
.ignite-panel__comment-author {
  font-size: .75rem;
  font-weight: 700;
  margin-bottom: 3px;
}
.ignite-panel__comment-text {
  font-size: .85rem;
  line-height: 1.5;
  opacity: .8;
}
.ignite-panel__comment-date {
  font-size: .65rem;
  opacity: .45;
  margin-top: 3px;
}

.ignite-panel__no-comments {
  font-size: .85rem;
  opacity: .5;
  text-align: center;
  padding: 20px 0;
}

/* ── Related posts ───────────────────────────────────────────────────────── */
.ignite-panel__related {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid rgba(0,0,0,.07);
}
body.bb-dark-mode .ignite-panel__related { border-top-color: rgba(255,255,255,.07); }

.ignite-panel__related-title {
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ignite-panel__related-title::before {
  content: '';
  display: inline-block;
  width: 3px; height: 1em;
  background: var(--ig-accent, #00ffc8);
  border-radius: 2px;
}

.ignite-panel__related-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 12px;
  scrollbar-width: none;
  margin: 0 -20px;
  padding-left: 20px;
  padding-right: 20px;
}
.ignite-panel__related-track::-webkit-scrollbar { display: none; }

/* Related cards reuse .ignite-card but smaller */
.ignite-panel__related-track .ignite-card {
  width: clamp(160px, 42vw, 220px);
  flex-shrink: 0;
}

/* ── Mobile: smaller padding, allow columns to wrap ─────────────────────── */
@media (max-width: 480px) {
  .ignite-panel__article { padding: 16px 12px 40px; }
  /* Let Gutenberg's is-not-stacked-on-mobile class control stacking — no override */
}

/* ── Mobile: panel full width ───────────────────────────────────────────── */
@media (max-width: 680px) {
  .ignite-panel { max-width: 100%; }
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ignite-panel, .ignite-panel__backdrop { transition: none; }
  .ignite-panel__spinner { animation: none; border-top-color: #a800ff; }
}

/* ── Toast notification ──────────────────────────────────────────────────── */
.ignite-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #1a1a1a;
  color: #fff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: .82rem;
  font-weight: 500;
  z-index: 2000;
  opacity: 0;
  transition: opacity .22s, transform .22s;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
.ignite-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
body.bb-dark-mode .ignite-toast { background: #fff; color: #1a1a1a; }

/* ── Tag results grid (inside panel) ─────────────────────────────────────── */
.ignite-tag-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.ignite-tag-results-grid .ignite-card {
  width: 100%;
  cursor: pointer;
}

/* ── Prevent body scroll bleed on iOS when panel is open ─────────────────── */
body.ignite-panel-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  overscroll-behavior: none;
}

/* ── Subscribe popup ─────────────────────────────────────────────────────── */
.ignite-subscribe-popup {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.ignite-subscribe-popup[hidden] { display: none; }

.ignite-subscribe-popup__box {
  background: #fff;
  border-radius: 12px;
  padding: 28px 24px 24px;
  width: 100%;
  max-width: 380px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  animation: igPopupIn .22s cubic-bezier(.4,0,.2,1);
}
body.bb-dark-mode .ignite-subscribe-popup__box {
  background: #1e1e1e;
}

@keyframes igPopupIn {
  from { opacity: 0; transform: scale(.94) translateY(8px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}

.ignite-subscribe-popup__close {
  position: absolute;
  top: 12px; right: 12px;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.06);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: inherit;
  transition: background .15s;
}
.ignite-subscribe-popup__close:hover { background: rgba(0,0,0,.12); }
body.bb-dark-mode .ignite-subscribe-popup__close { background: rgba(255,255,255,.1); }

.ignite-subscribe-popup__title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 6px;
}

.ignite-subscribe-popup__desc {
  font-size: .82rem;
  opacity: .6;
  margin: 0 0 18px;
  line-height: 1.5;
}

.ignite-subscribe-popup__input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,.14);
  background: rgba(0,0,0,.03);
  font-size: 15px; /* 15px+ prevents iOS zoom */
  font-family: inherit;
  color: inherit;
  box-sizing: border-box;
  margin-bottom: 10px;
  transition: border-color .18s;
}
.ignite-subscribe-popup__input:focus {
  outline: none;
  border-color: #a800ff;
}
body.bb-dark-mode .ignite-subscribe-popup__input {
  border-color: rgba(255,255,255,.15);
  background: rgba(255,255,255,.06);
}

.ignite-subscribe-popup__error {
  font-size: .78rem;
  color: #ef4444;
  margin: -4px 0 8px;
}
.ignite-subscribe-popup__error[hidden] { display: none; }

.ignite-subscribe-popup__submit {
  width: 100%;
  height: 44px;
  border-radius: 6px;
  border: none;
  background: #a800ff;
  color: #fff;
  font-size: .9rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background .18s, opacity .18s;
  margin-top: 4px;
}
.ignite-subscribe-popup__submit:hover  { background: #8c00d4; }
.ignite-subscribe-popup__submit:disabled { opacity: .6; cursor: default; }

.ignite-subscribe-popup__success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 12px 0 4px;
  text-align: center;
}
.ignite-subscribe-popup__success[hidden] { display: none; }
.ignite-subscribe-popup__success p {
  font-size: .9rem;
  font-weight: 600;
  margin: 0;
}

/* ── Action bar on single post pages ─────────────────────────────────────── */
.ignite-post-actions {
  margin: 32px 0 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(0,0,0,.07);
}
body.bb-dark-mode .ignite-post-actions {
  border-top-color: rgba(255,255,255,.07);
}
