/* News Pulse page only: hero chip extras + the white-label widget preview.
   The widget (.npw) themes itself only through custom properties scoped to its root. */

/* ---------- hero chips ---------- */
.np-wave { display: flex; align-items: center; gap: 3px; height: 40px; margin: 6px 0 12px; }
.np-wave i { flex: 1; min-width: 2px; border-radius: 2px; background: var(--glow); }
.np-wave i.off { background: rgba(43, 196, 138, .28); }
.np-chip-row { display: flex; justify-content: space-between; gap: 10px; font-size: .86rem; padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.np-chip-row b { font-weight: 600; color: var(--night-muted); }
.np-chip-row b.ok { color: #6FD3AE; }
.np-chip-row + small { display: block; margin-top: 8px; }

/* ---------- demo controls ---------- */
.np-demo-body { grid-template-columns: minmax(0, .72fr) minmax(0, 1.28fr); align-items: start; }
@media (max-width: 860px) { .np-demo-body { grid-template-columns: minmax(0, 1fr); } }
.np-controls { gap: 20px; }
@media (min-width: 861px) { .np-controls { position: sticky; top: calc(var(--header-h) + 24px); } }
.np-ctl { display: grid; gap: 8px; justify-items: start; }
.np-ctl-label { font-size: .92rem; font-weight: 500; }
.np-ctl-label small { color: var(--fg-muted); font-weight: 400; font-size: .82rem; margin-left: 6px; }
.np-controls .seg { flex-wrap: wrap; max-width: 100%; }
.np-controls .seg button:disabled { opacity: .45; cursor: not-allowed; }
.np-ar-btn { font-family: var(--font-arabic) !important; font-size: .95rem !important; }
.np-tokens { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.np-tokens div { display: grid; gap: 2px; min-width: 0; }
.np-tokens dt { color: var(--fg-muted); font-size: .8rem; }
.np-tokens dd { margin: 0; font-weight: 600; font-size: .92rem; display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.np-tokens dd i { width: 14px; height: 14px; border-radius: 4px; flex: none; border: 1px solid var(--line); }
.np-stage { min-width: 0; container-type: inline-size; }

/* ---------- widget tokens ---------- */
.npw {
  /* surface: light */
  --w-bg: #FFFFFF; --w-fg: #121418; --w-muted: #556070; --w-line: #E1E5EA;
  --w-pos: #0F7B4B; --w-neg: #B4232A; --w-warn: #8A5A00;
  /* brand defaults */
  --w-accent: #2A5DB0; --w-accent-ink: #FFFFFF;
  --w-radius: 12px; --w-radius-s: 8px;
  --w-font-latin: system-ui, sans-serif; --w-font-ar: system-ui, sans-serif;
  /* derived */
  --w-raised: color-mix(in srgb, var(--w-accent) 5%, var(--w-bg));
  --w-soft: color-mix(in srgb, var(--w-accent) 13%, var(--w-bg));
  --w-font: var(--w-font-latin);
}
.npw[data-surface="dark"] {
  --w-bg: #15191F; --w-fg: #EEF0F4; --w-muted: #AEB5C1; --w-line: #323945;
  --w-pos: #4CC38A; --w-neg: #FF8A84; --w-warn: #E9C25B;
}
.npw[lang="ar"] { --w-font: var(--w-font-ar); }

/* Brand A: deep green, rounded, IBM Plex */
.npw[data-brand="a"] { --w-accent: #0E5A43; --w-accent-ink: #FFFFFF; --w-radius: 14px; --w-radius-s: 8px;
  --w-font-latin: "IBM Plex Sans", system-ui, sans-serif; --w-font-ar: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, sans-serif; }
.npw[data-brand="a"][data-surface="dark"] { --w-accent: #5FD3A6; --w-accent-ink: #03231A; }
/* Brand B: navy, sharp corners, Tajawal */
.npw[data-brand="b"] { --w-accent: #1F3A93; --w-accent-ink: #FFFFFF; --w-radius: 3px; --w-radius-s: 2px;
  --w-font-latin: "Tajawal", system-ui, sans-serif; --w-font-ar: "Tajawal", system-ui, sans-serif; }
.npw[data-brand="b"][data-surface="dark"] { --w-accent: #9DB7FF; --w-accent-ink: #0B1B3A; }
/* Brand C: plum, very round, Cairo */
.npw[data-brand="c"] { --w-accent: #8A2C4F; --w-accent-ink: #FFFFFF; --w-radius: 22px; --w-radius-s: 999px;
  --w-font-latin: "Cairo", system-ui, sans-serif; --w-font-ar: "Cairo", system-ui, sans-serif; }
.npw[data-brand="c"][data-surface="dark"] { --w-accent: #F29BBC; --w-accent-ink: #3A0A1D; }

/* ---------- widget layout ---------- */
.npw {
  font-family: var(--w-font); font-size: 15px; line-height: 1.55; color: var(--w-fg); background: var(--w-bg);
  border: 1px solid var(--w-line); border-radius: var(--w-radius); overflow: hidden; text-align: start;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 18px 40px -20px rgba(16, 24, 40, .35);
  transition: background-color .2s ease, color .2s ease, border-radius .2s ease;
}
.npw * { font-family: inherit; }
.npw h4, .npw h5 { font-family: inherit; letter-spacing: 0; line-height: 1.3; margin: 0; }
.npw button { font: inherit; color: inherit; cursor: pointer; }
.npw :focus-visible { outline: 2px solid var(--w-accent); outline-offset: 2px; }

/* host app chrome (belongs to the client, not to the widget) */
.npw-bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--w-raised); border-bottom: 1px solid var(--w-line); }
.npw-mark { width: 28px; height: 28px; border-radius: var(--w-radius-s); background: var(--w-accent); color: var(--w-accent-ink); display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
.npw[data-brand="c"] .npw-mark { border-radius: 50%; }
.npw-bar b { font-weight: 600; font-size: .95rem; }
.npw-nav { margin-inline-start: auto; display: flex; gap: 14px; font-size: .85rem; color: var(--w-muted); }
.npw-nav span[aria-current] { color: var(--w-fg); font-weight: 600; box-shadow: inset 0 -2px 0 var(--w-accent); padding-bottom: 2px; }
@container (max-width: 440px) { .npw-nav span:not([aria-current]) { display: none; } }

.npw-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 16px 16px 12px; }
.npw-head h4 { font-size: 1.05rem; font-weight: 700; }
.npw-filter { margin-inline-start: auto; display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--w-line); border-radius: var(--w-radius-s); background: var(--w-raised); }
.npw-filter button { border: 0; background: none; padding: 5px 11px; border-radius: calc(var(--w-radius-s) - 2px); font-size: .82rem; font-weight: 500; color: var(--w-muted); }
.npw[data-brand="c"] .npw-filter button { border-radius: 999px; }
.npw-filter button[aria-pressed="true"] { background: var(--w-accent); color: var(--w-accent-ink); }

/* briefing player */
.npw-brief { margin: 0 16px 14px; padding: 12px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; align-items: center; background: var(--w-soft); border-radius: var(--w-radius); }
.npw .npw-play { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--w-accent); color: var(--w-accent-ink); display: grid; place-items: center; grid-row: span 2; }
.npw-play svg { width: 18px; height: 18px; }
.npw[dir="rtl"] .npw-play svg.tri { transform: scaleX(-1); }
.npw-brief-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.npw-brief-top b { font-size: .92rem; }
.npw-brief-top span { font-size: .78rem; color: var(--w-muted); font-variant-numeric: tabular-nums; }
.npw-wave { display: flex; align-items: center; gap: 2px; height: 26px; }
.npw-wave i { flex: 1; min-width: 1px; border-radius: 2px; background: color-mix(in srgb, var(--w-accent) 30%, transparent); transition: background-color .2s ease; }
.npw-wave i.on { background: var(--w-accent); }
.npw.is-playing .npw-wave i.on:last-of-type { animation: npwPulse .8s ease-in-out infinite alternate; }
@keyframes npwPulse { from { opacity: .5; } to { opacity: 1; } }
.npw-brief-lbl { grid-column: 1 / -1; font-size: .74rem; color: var(--w-muted); margin-top: 4px; }

/* news bites */
.npw-list { border-top: 1px solid var(--w-line); }
.npw-bite { padding: 14px 16px; border-bottom: 1px solid var(--w-line); display: grid; gap: 7px; }
.npw-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.npw-tag { font-size: .74rem; font-weight: 500; line-height: 1; padding: 5px 8px; border-radius: var(--w-radius-s); border: 1px solid var(--w-line); color: var(--w-muted); white-space: nowrap; }
.npw-tag.is-stock { background: var(--w-soft); border-color: transparent; color: var(--w-fg); font-weight: 600; }
.npw-bite h5 { font-size: 1rem; font-weight: 700; }
.npw-bite p { font-size: .9rem; color: var(--w-fg); opacity: .92; }
.npw-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: .76rem; color: var(--w-muted); }
.npw-src { color: var(--w-accent); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
.npw-sent { display: inline-flex; align-items: center; gap: 5px; }
.npw-sent::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--w-muted); }
.npw-sent[data-v="positive"]::before { background: var(--w-pos); }
.npw-ai { border: 1px dashed var(--w-line); border-radius: 4px; padding: 1px 6px; }

/* impact explainer */
.npw .npw-exp-btn { justify-self: start; display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 4px 0; color: var(--w-accent); font-weight: 600; font-size: .85rem; }
.npw-exp-btn svg { width: 14px; height: 14px; transition: transform .2s ease; }
.npw-exp-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.npw-exp[hidden] { display: none; }
.npw-exp { background: var(--w-raised); border-inline-start: 3px solid var(--w-accent); border-radius: var(--w-radius-s); padding: 10px 12px; display: grid; gap: 6px; }
.npw[data-brand="c"] .npw-exp { border-radius: 12px; }
.npw-exp p { font-size: .86rem; }
.npw-exp small { font-size: .74rem; color: var(--w-muted); }
.npw-lesson { justify-self: start; display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 600; padding: 6px 10px 6px 8px; border-radius: var(--w-radius-s); border: 1px solid var(--w-line); background: var(--w-bg); }
.npw-lesson svg { width: 16px; height: 16px; color: var(--w-accent); flex: none; }

/* Shariah per source */
.npw-sh { padding: 14px 16px; display: grid; gap: 10px; background: var(--w-raised); border-bottom: 1px solid var(--w-line); }
.npw-sh-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; }
.npw-sh-head h5 { font-size: .92rem; font-weight: 700; }
.npw-sh-head span { font-size: .74rem; color: var(--w-muted); }
.npw-sh ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.npw-sh li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; padding: 8px 10px; border-radius: var(--w-radius-s); background: var(--w-bg); border: 1px solid var(--w-line); font-size: .84rem; }
.npw[data-brand="c"] .npw-sh li { border-radius: 14px; }
.npw-sh li small { grid-column: 1 / -1; font-size: .74rem; color: var(--w-muted); }
.npw-st { font-weight: 600; font-size: .78rem; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; color: var(--w-muted); }
.npw-st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid currentColor; }
.npw-st.ok { color: var(--w-pos); }
.npw-st.ok::before { background: currentColor; }

.npw-foot { padding: 12px 16px 14px; font-size: .76rem; color: var(--w-muted); display: grid; gap: 4px; }
.npw-foot b { color: var(--w-fg); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .npw.is-playing .npw-wave i.on:last-of-type { animation: none; }
}
