/*!
 * BullBridge News — news.html page styles
 * Builds on style.css components (page hero, section heads, ncard / latest / pulse / fchip / segmented / state).
 * Tokens only (both themes). RTL-first, logical properties.
 *   1 Hero (date line, coverage panel, stale notice)   4 Sidebar (latest, pulse, sources)
 *   2 Top stories                                       5 About note
 *   3 Browser (filter bar, topics, list ⇄ grid)         6 Responsive & touch
 */

/* ======================================================================
   1 · HERO
   ====================================================================== */
.nh-meta { gap: 10px 16px; }
.nh-date { margin: 0; }
.nh-date .icon { width: 15px; height: 15px; color: var(--text-3); }
.nh-stamp { margin: 0; }
.nh-stale {
  display: flex; align-items: flex-start; gap: 10px; max-width: 62ch; margin-top: var(--sp-4); padding: 10px 14px;
  border-radius: var(--radius-sm); background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  font-size: var(--fs-sm); line-height: 1.75; color: var(--text-2);
}
.nh-stale .icon { flex: none; width: 18px; height: 18px; margin-top: 3px; color: var(--warn); }

/* coverage panel: headlines per category (filled by pages/news.js) */
.cov {
  display: flex; flex-direction: column; gap: 14px; padding: 20px 20px 14px;
  background: color-mix(in srgb, var(--surface) 86%, transparent); box-shadow: var(--shadow-lg);
}
.cov__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cov__title { font-family: var(--font-head); font-size: 17px; font-weight: 700; line-height: 1.4; color: var(--text); }
.cov__src {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.cov__src:hover { color: var(--text); border-color: var(--border-strong); }
.cov__src .icon { width: 15px; height: 15px; }
.cov__total { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.cov__big { display: inline-flex; align-items: baseline; gap: 8px; font-size: 16px; font-weight: 600; color: var(--text-2); line-height: 1.2; }
.cov__big .num { font-family: var(--font-head); font-size: 44px; font-weight: 800; line-height: 1; color: var(--text); letter-spacing: -.01em; }
.cov__sub { font-size: var(--fs-sm); color: var(--text-3); line-height: 1.5; }
.cov__sub b { color: var(--text-2); font-weight: 700; }
.cov__list { list-style: none; margin: 0 -10px; padding: 0; display: grid; gap: 2px; }
.cov__row {
  position: relative; display: grid; grid-template-columns: minmax(8.6em, auto) minmax(0, 1fr) 2.6em 16px; align-items: center; gap: 12px;
  min-height: 44px; padding: 0 10px; border-radius: 12px; color: var(--text); text-decoration: none;
  transition: background-color var(--t-fast);
}
.cov__row:hover { background: var(--surface-2); }
.cov__name { display: inline-flex; align-items: center; gap: 9px; font-size: 14.5px; font-weight: 600; white-space: nowrap; }
.cov__name .dot { box-shadow: none; }
.cov__bar { position: relative; height: 8px; border-radius: var(--radius-pill); overflow: hidden; background: color-mix(in srgb, var(--accent) 15%, transparent); }
.cov__bar i {
  position: absolute; inset: 0; border-radius: inherit; background: var(--accent);
  transform-origin: right center; transform: scaleX(0); transition: transform .9s var(--ease);
}
.cov.is-ready .cov__bar i { transform: scaleX(var(--r, 0)); }
.cov__n { font-size: 15px; font-weight: 700; text-align: end; color: var(--text); }
.cov__go { width: 16px; height: 16px; color: var(--text-3); transition: transform var(--t-med) var(--ease-spring), color var(--t-fast); }
.cov__row:hover .cov__go { color: var(--text); transform: translateX(-3px); }
.cov--empty .state { padding: 24px 16px; }

/* ======================================================================
   2 · TOP STORIES (featured + newest story per market)
   ====================================================================== */
/* reserved space (skeleton tint) until news.js renders, so nothing paints blank or jumps */
.top-stories__lead:empty, .top-stories__slot:empty, .news-aside__latest:empty, .news-browser:empty, .news-pulse [data-pulse]:empty {
  border-radius: var(--radius-lg); background: var(--skeleton);
}
.top-stories__lead:empty { min-height: 560px; }
.top-stories__slot:empty { min-height: 120px; }
.news-aside__latest:empty { min-height: 640px; }
.news-browser:empty { min-height: 1200px; }
.news-pulse [data-pulse]:empty { min-height: 300px; }
.top-stories { display: grid; grid-template-columns: minmax(0, 1.42fr) minmax(0, 1fr); gap: var(--gap); align-items: stretch; }
.top-stories.is-single { grid-template-columns: minmax(0, 1fr); }
.top-stories__lead { display: flex; min-width: 0; }
.top-stories__lead > * { flex: 1 1 auto; min-width: 0; }
.top-stories__side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.top-stories__label { display: flex; align-items: center; gap: 8px; min-height: 28px; padding-inline: 4px; font-size: var(--fs-sm); font-weight: 700; color: var(--text-2); }
.top-stories__label .icon { width: 16px; height: 16px; color: var(--text-3); }
.top-stories__slot { flex: 1 1 0; display: flex; min-width: 0; }
.top-stories__slot > .news-list { flex: 1; display: flex; }
.top-stories__slot .ncard--row { flex: 1; align-items: center; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; }
.top-stories__slot .ncard__summary { display: none; }
.top-stories__slot .ncard__body { gap: 7px; }
.top-stories__slot .ncard__title { font-size: 18px; -webkit-line-clamp: 2; }

/* ======================================================================
   3 · BROWSER: filter bar, topic chips, list ⇄ grid
   ====================================================================== */
.news-layout { display: grid; grid-template-columns: minmax(0, 1fr) 356px; gap: var(--sp-8) 36px; align-items: start; }
.news-layout__main { min-width: 0; }
.news-layout__aside { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
/* sticky only once pages/news.js has measured it (a tall sidebar then sticks by its bottom edge) */
.news-layout__aside.is-sticky { position: sticky; top: var(--aside-top, calc(var(--header-h) + 20px)); }

.news-browser .news-filter__bar { align-items: center; gap: 12px; margin-bottom: 14px; }
.news-browser .filter-chips { flex: 1 1 100%; min-width: 0; }
.news-browser .fchip { min-height: 44px; }
.news-browser .news-filter__search { flex: 1 1 260px; max-width: none; }
.news-browser .news-filter__search .input { background: var(--surface); }
.news-browser .news-filter__search .input::-webkit-search-cancel-button { cursor: pointer; }
.nb-view { flex: none; }
.nb-view > button { gap: 8px; padding-inline: 14px; }
.nb-view .icon { width: 17px; height: 17px; }

.nb-topics { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 14px; }
.nb-topics__label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 700; color: var(--text-2); white-space: nowrap; }
.nb-topics__label .icon { width: 16px; height: 16px; color: var(--text-3); }
/* rails are containing blocks, so visually-hidden text never escapes a scrolled rail (phones); .filter-chips is in style.css */
.nb-topics__list, .cov__list { position: relative; }
.nb-topics__list { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.tchip {
  position: relative; display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 13px; border-radius: var(--radius-pill);
  border: 1px dashed var(--border-strong); background: transparent; color: var(--text-2); font-size: 13.5px; font-weight: 600; line-height: 1.3;
  transition: color var(--t-fast), background-color var(--t-fast), border-color var(--t-fast);
}
.tchip:hover { color: var(--text); border-style: solid; border-color: var(--text-3); }
.tchip__n { font-size: 12px; font-weight: 700; color: var(--text-3); }
.tchip[aria-pressed="true"] { border-style: solid; border-color: var(--text); background: var(--surface-3); color: var(--text); }
.tchip[aria-pressed="true"] .tchip__n { color: var(--text-2); }

.news-browser .news-filter__status { margin-bottom: 12px; }
.news-browser .news-list { gap: 12px; }
.news-browser .news-filter__more .btn { min-width: 240px; }

@media (min-width: 700px) {
  .news-browser .ncard--row { grid-template-columns: 208px minmax(0, 1fr); gap: 18px; padding: 12px; }
  .news-browser .ncard--row .ncard__body { padding-top: 2px; }
  .news-browser .ncard--row .ncard__title { font-size: 19.5px; }
  /* grid view: the same rows, laid out as photo cards */
  .news-browser.is-grid .news-list { grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: var(--gap); }
  .news-browser.is-grid .ncard--row { display: flex; flex-direction: column; align-items: stretch; gap: 0; padding: 10px 10px 16px; }
  .news-browser.is-grid .ncard--row .ncard__media { border-radius: 14px; }
  .news-browser.is-grid .ncard--row .ncard__body { padding: 14px 8px 0; gap: 10px; }
  .news-browser.is-grid .ncard--row .ncard__title { font-size: 19px; -webkit-line-clamp: 3; }
}

/* ======================================================================
   4 · SIDEBAR: الأحدث · نبض السوق · مصادرنا
   ====================================================================== */
.news-aside__latest .latest { padding: 18px 20px 8px; }
.news-aside__latest .latest__link { font-size: 17px; }
/* a story from an earlier day carries «أمس» / «10 نوفمبر» under its time (news.js adds .has-days): a little more room */
.news-aside__latest.has-days .latest__item { grid-template-columns: 60px minmax(0, 1fr); }
.news-aside__latest .latest__day { font-weight: 600; }

.news-pulse { padding: 18px; }
.news-pulse__head { display: grid; gap: 2px; margin-bottom: 12px; }
.news-pulse__title { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-size: 20px; font-weight: 700; line-height: 1.3; }
.news-pulse__title .icon { width: 21px; height: 21px; color: var(--text-2); }
.news-pulse .pulse-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.news-pulse .qt { padding: 10px 11px 8px; border-radius: 14px; background: var(--surface-2); }
.news-pulse a.qt:hover { background: var(--surface-3); }
.news-pulse .qt:last-child:nth-child(odd) { grid-column: 1 / -1; }
.news-pulse .qt__badge { display: none; }
.news-pulse .qt__name { font-size: 13.5px; }
.news-pulse .qt__mid { flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 6px; }
.news-pulse .qt:last-child:nth-child(odd) .qt__mid { flex-direction: row; align-items: center; justify-content: space-between; }
.news-pulse .qt__px { font-size: 16px; }
/* the chips stack under the price here, so they keep the 12px minimum even in the narrow sidebar tiles */
.news-pulse .qt .chg { font-size: 12px; }
.news-pulse .qt__spark { min-height: 30px; margin-top: 6px; }

.sources { padding: 18px 18px 14px; }
.sources__head { margin-bottom: 6px; }
.sources__title { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-size: 20px; font-weight: 700; line-height: 1.3; }
.sources__title .icon { width: 21px; height: 21px; color: var(--text-2); }
.sources__sub { margin-top: 2px; font-size: 12.5px; color: var(--text-3); line-height: 1.6; }
.sources__warn { color: var(--warn); font-weight: 600; }
.sources__list { list-style: none; margin: 0; padding: 0; }
.sources__skel { display: grid; gap: 4px; padding: 10px 0; }
.src {
  position: relative; display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  min-height: 56px; padding: 7px 4px; border-bottom: 1px solid var(--border); border-radius: 10px;
  transition: background-color var(--t-fast);
}
.src:last-child { border-bottom-color: transparent; }
.src:hover { background: var(--surface-2); }
.src__state { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); }
.src__state .icon { width: 15px; height: 15px; stroke-width: 2.2; }
.src[data-state="ok"] .src__state { background: var(--info-soft); color: var(--info); }
.src[data-state="partial"] .src__state, .src[data-state="stale"] .src__state { background: var(--warn-soft); color: var(--warn); }
.src__body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.src__name { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; max-width: 100%; font-size: 14.5px; font-weight: 700; line-height: 1.45; color: var(--text); text-decoration: none; }
a.src__name::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
a.src__name:focus-visible { outline: none; }
a.src__name:focus-visible::after { outline: 2px solid var(--focus); outline-offset: 1px; }
.src:hover a.src__name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.src__ext { width: 13px; height: 13px; flex: none; color: var(--text-3); }
.src__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; font-size: 12px; color: var(--text-3); line-height: 1.6; }
.src__cat { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.src__cat .dot { width: 6px; height: 6px; box-shadow: none; }
.src__flag { color: var(--warn); font-weight: 600; }
.src__count { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; text-align: end; }
.src__count b { font-family: var(--font-head); font-size: 17px; font-weight: 700; color: var(--text); }
.src__count small { font-size: 12px; color: var(--text-3); }
.src__count .src__none { font-weight: 600; }
.sources__note { margin-top: 8px; padding-top: 10px; border-top: 1px dashed var(--border-strong); font-size: 12.5px; color: var(--text-3); line-height: 1.75; }
.nb-state { padding: 22px 14px; }

/* ======================================================================
   5 · ABOUT NOTE
   ====================================================================== */
.about-note { padding: clamp(20px, 2.6vw, 32px); }
.about-note__steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px 28px; }
.about-step { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 2px 14px; align-content: start; }
.about-step__icon { grid-row: span 2; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--economy-soft); color: var(--economy-ink); }
.about-step__icon .icon { width: 21px; height: 21px; }
.about-step__title { font-family: var(--font-head); font-size: 17px; font-weight: 700; line-height: 1.5; padding-top: 2px; }
.about-step__text { font-size: 14.5px; line-height: 1.85; color: var(--text-2); }
.about-step__text .badge { min-height: 22px; padding: 0 8px; border-radius: var(--radius-pill); font-size: 12px; vertical-align: 1px; }
/* four steps in a row on desktop: the icon sits above its title, so each text gets the full column */
@media (min-width: 1100px) {
  .about-step { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .about-step__icon { grid-row: auto; margin-bottom: 14px; }
}
.about-note__foot {
  display: flex; align-items: flex-start; gap: 10px; margin-top: 24px; padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border); font-size: var(--fs-sm); line-height: 1.8; color: var(--text-2);
}
.about-note__foot .icon { flex: none; width: 18px; height: 18px; margin-top: 3px; color: var(--warn); }
.about-note__foot b { color: var(--text); font-weight: 700; }

/* ======================================================================
   6 · RESPONSIVE & TOUCH
   ====================================================================== */
@media (max-width: 1279px) {
  .news-layout { grid-template-columns: minmax(0, 1fr) 320px; gap: var(--sp-8) 28px; }
  .top-stories__slot .ncard--row { grid-template-columns: 128px minmax(0, 1fr); gap: 14px; }
  .top-stories__slot .ncard__title { font-size: 17px; }
}
@media (max-width: 1099px) {
  .cov__list { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
  .top-stories { grid-template-columns: minmax(0, 1fr); }
  .top-stories__side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .top-stories__label { grid-column: 1 / -1; }
  .top-stories__slot .ncard--row { grid-template-columns: 120px minmax(0, 1fr); align-items: start; }
  .about-note__steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 32px; }
}
@media (min-width: 700px) and (max-width: 1099px) {
  /* two slots per row: a narrower photo and no decorative link glyph, so «Investing.com عربي · منذ ساعتين» fits */
  .top-stories__slot .ncard--row { grid-template-columns: 112px minmax(0, 1fr); gap: 12px; }
  .top-stories__slot .ncard__ext { display: none; }
}
@media (max-width: 1023px) {
  .news-layout { grid-template-columns: minmax(0, 1fr); }
  /* tablet: «الأحدث» beside the pulse, then the sources card across the full width in two columns */
  .news-layout__aside, .news-layout__aside.is-sticky { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
  .news-aside__latest { display: flex; }
  .news-aside__latest > * { flex: 1 1 auto; }
  .news-pulse { display: flex; flex-direction: column; }
  /* the tiles share the height of «الأحدث» beside them (the renderer's wrapper must flex too) */
  .news-pulse > [data-pulse] { flex: 1 1 auto; display: flex; flex-direction: column; }
  .news-pulse .pulse-grid { flex: 1 1 auto; grid-auto-rows: 1fr; }
  .news-pulse .qt__spark { min-height: 40px; }
  .sources { grid-column: 1 / -1; }
  .sources__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }
  .sources__list .src:nth-last-child(2):nth-child(odd) { border-bottom-color: transparent; }
}
@media (max-width: 699px) {
  /* hero: compact — title, one-line lead, freshness, and the market shortcuts as a swipe rail */
  .news-page .page-hero { padding-bottom: 22px; }
  .nh-lead-more { display: none; }
  .nh-meta { gap: 8px 12px; margin-top: var(--sp-4); }
  .nh-date { font-size: 12.5px; padding-inline: 10px; }
  .news-page .page-hero__aside { margin-top: -8px; }
  .cov { gap: 10px; padding: 0; background: none; border: 0; box-shadow: none; border-radius: 0; }
  .cov__head { display: block; height: 0; }
  .cov__title { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .cov__src { display: none; }
  .cov__total { padding-bottom: 0; border-bottom: 0; gap: 2px 10px; }
  .cov__big { font-size: 14px; gap: 6px; }
  .cov__big .num { font-size: 22px; }
  .cov__sub { font-size: 12.5px; }
  .cov__list {
    display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
    margin-inline: calc(var(--gutter) * -1); padding: 2px var(--gutter) 6px; scroll-padding-inline: var(--gutter);
  }
  .cov__list::-webkit-scrollbar { display: none; }
  .cov__list li { flex: none; }
  .cov__row {
    display: inline-flex; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: var(--radius-pill);
    border: 1px solid var(--border-strong); background: var(--surface);
  }
  .cov__row:hover { background: var(--surface-2); }
  .cov__name { font-size: 14px; }
  .cov__n { font-size: 13px; min-width: 0; padding: 1px 7px; border-radius: var(--radius-pill); background: var(--surface-3); color: var(--text-2); }
  .cov__bar, .cov__go { display: none; }

  .top-stories__side { display: flex; gap: 10px; }
  .top-stories__slot .ncard--row { grid-template-columns: 104px minmax(0, 1fr); gap: 12px; padding: 10px; }
  .top-stories__slot .ncard__title { font-size: 16.5px; -webkit-line-clamp: 3; }

  /* browser: category tabs and topics become thumb-friendly swipe rails */
  .news-browser .news-filter__bar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .news-browser .filter-chips {
    flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
    margin-inline: calc(var(--gutter) * -1); padding: 2px var(--gutter) 4px; scroll-padding-inline: var(--gutter);
  }
  .news-browser .filter-chips::-webkit-scrollbar { display: none; }
  .news-browser .fchip { flex: none; }
  .nb-view { display: none; }
  .nb-topics { display: grid; gap: 8px; }
  .nb-topics[hidden] { display: none; }
  .nb-topics__list {
    flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
    margin-inline: calc(var(--gutter) * -1); padding: 0 var(--gutter) 4px; scroll-padding-inline: var(--gutter);
  }
  .nb-topics__list::-webkit-scrollbar { display: none; }
  .tchip { flex: none; min-height: 44px; }
  .news-browser .news-list { gap: 10px; }
  .news-browser .news-filter__more { margin-top: var(--sp-6); }
  .news-browser .news-filter__more .btn { width: 100%; }

  /* the stream itself is chronological on phones; keep the sidebar to prices and sources
     (.is-sticky repeats the tablet selector's specificity, otherwise the pulse stays half-width) */
  .news-layout__aside, .news-layout__aside.is-sticky { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .sources__list { grid-template-columns: minmax(0, 1fr); }
  .sources__list .src:nth-last-child(2):nth-child(odd) { border-bottom-color: var(--border); }
  .news-pulse .qt__spark { min-height: 30px; }
  .news-aside__latest { display: none; }
  .news-pulse, .sources { padding: 16px; }
  .about-note__steps { grid-template-columns: minmax(0, 1fr); gap: 18px; }
}
@media (max-width: 380px) {
  .news-pulse .qt { padding: 9px 10px 7px; }
  .news-pulse .qt__px { font-size: 15px; }
  /* smallest phones: style.css narrows .ncard--row to a 96px photo and drops its link glyph; the slots set their own column */
  .top-stories__slot .ncard--row { grid-template-columns: 96px minmax(0, 1fr); gap: 10px; }
}
/* the copy button matches the 40px ghost buttons of the other section heads; phones and touch get 44px from style.css */
.news-page .copy-link { min-height: 40px; }
@media (pointer: coarse) {
  .cov__src { min-height: 44px; }
  .tchip { min-height: 44px; }
}
@media print {
  .news-layout { grid-template-columns: minmax(0, 1fr); }
  .news-layout__aside, .nb-topics, .nb-view, .news-filter__more { display: none !important; }
}
