/* MeritX News Flow */
.nf-dls { display:flex; gap:10px; flex-wrap:wrap; margin-top:16px; }
.nf-filters { position:relative; display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:12px; }
.nf-chip { font:600 12.5px/1 Inter, sans-serif; color:var(--mxc-text-2); background:var(--mxc-surface); border:1px solid var(--mxc-border); border-radius:10px; padding:9px 13px; cursor:pointer; transition:border-color .15s; }
.nf-chip b { color:var(--mx-indigo, #33058d); }
.nf-chip:hover { border-color:#C9A227; }
.nf-search { flex:1; min-width:200px; max-width:360px; font:500 13px/1.2 Inter, sans-serif; color:var(--mxc-text); background:var(--mxc-surface); border:1px solid var(--mxc-border); border-radius:10px; padding:9px 13px; outline:none; transition:border-color .15s; }
.nf-search:hover { border-color:#C9A227; }
.nf-search:focus { border-color:var(--mx-indigo, #33058d); }
.nf-status { margin-left:auto; font:600 10.5px/1 var(--font-mono, monospace); letter-spacing:.06em; color:var(--mxc-muted); }
.nf-menu { position:absolute; z-index:60; min-width:210px; max-height:320px; overflow-y:auto; background:var(--mxc-surface); border:1px solid var(--mxc-border); border-radius:12px; padding:6px; box-shadow:0 18px 50px rgba(10,8,24,.28); }
.nf-menu[hidden] { display:none; }
.nf-menu button, .nf-menu a { display:block; width:100%; text-align:left; font:600 12.5px/1.3 Inter, sans-serif; color:var(--mxc-text); background:none; border:0; border-radius:8px; padding:8px 10px; cursor:pointer; text-decoration:none; }
.nf-menu button:hover, .nf-menu a:hover { background:var(--mxc-hover, rgba(120,120,140,.08)); color:var(--mx-indigo, #33058d); }

.nf-wrap { display:grid; grid-template-columns:1fr; gap:16px; align-items:start; }
.nf-wrap:has(.nf-reader:not([hidden])) { grid-template-columns:1.55fr 1fr; }
.nf-table { border:1px solid var(--mxc-border); border-radius:14px; background:var(--mxc-surface); overflow:hidden; }
.nf-head { display:grid; grid-template-columns:110px 1fr; gap:10px; padding:11px 16px; font:700 9.5px/1 var(--font-mono, monospace); letter-spacing:.12em; text-transform:uppercase; color:var(--mxc-muted); border-bottom:1px solid var(--mxc-border); }
.nf-row { display:grid; grid-template-columns:110px 1fr; gap:10px; align-items:center; width:100%; padding:11px 16px; background:none; border:0; border-top:1px solid var(--mxc-border); cursor:pointer; text-align:left; font:inherit; color:var(--mxc-text); }
.nf-row:first-child { border-top:0; }
.nf-row:hover { background:var(--mxc-hover, rgba(120,120,140,.06)); }
.nf-row.is-sel { background:color-mix(in srgb, var(--mx-indigo, #33058d) 8%, transparent); }
.nf-row__t { font:600 11px/1 var(--font-mono, monospace); color:var(--mxc-muted); white-space:nowrap; }
.nf-row__h { font-size:13.5px; font-weight:600; line-height:1.45; }
.nf-row__p { font:700 11px/1.3 Inter, sans-serif; color:var(--mx-indigo, #33058d); text-align:right; }

/* The panel carries the FULL rewritten article. It is NOT scrollable and NOT sticky —
   it simply grows downward to whatever length the story needs, and the page scrolls.
   (A sticky panel taller than the viewport would pin its top and put the end of the
   article permanently out of reach; an inner scrollbar inside a scrolling page is worse
   again. Letting it extend is the only version where you can actually read to the end.) */
/* relative (not static) so the absolutely-positioned close button still anchors here */
.nf-reader { position:relative; border:1px solid var(--mxc-border); border-radius:14px; background:var(--mxc-surface); padding:18px 20px 20px; }
.nf-reader__body { margin-bottom:4px; }
.nf-reader__body .nfr-p { font-size:14px; line-height:1.75; margin:0 0 13px; color:var(--mxc-text, #dfe3ea); }
.nf-reader__body .nfr-p:last-child { margin-bottom:0; }
.nf-reader[hidden] { display:none; }
.nf-reader__x { position:absolute; top:10px; right:12px; font:700 13px/1 Inter, sans-serif; color:var(--mxc-muted); background:none; border:0; cursor:pointer; padding:6px; border-radius:8px; }
.nf-reader__x:hover { color:var(--mxc-text); background:var(--mxc-hover, rgba(120,120,140,.1)); }
.nf-reader__tags { display:flex; gap:6px; margin-bottom:10px; }
.nf-reader__title { font-size:19px; font-weight:800; line-height:1.35; margin:0 18px 8px 0; color:var(--mxc-text); }
.nf-reader__meta { font:600 11px/1 var(--font-mono, monospace); color:var(--mxc-muted); margin-bottom:12px; }
.nf-reader__desc { font-size:13.5px; line-height:1.65; color:var(--mxc-text-2); margin:0 0 16px; }
.nf-reader__foot { margin-top:16px; padding-top:12px; border-top:1px solid var(--mxc-border); font:600 10px/1 var(--font-mono, monospace); letter-spacing:.08em; text-transform:uppercase; color:var(--mxc-muted); }
/* below this the side column is too narrow to read an article in, so the panel
   drops under the table instead of beside it */
@media (max-width:1100px) { .nf-wrap:has(.nf-reader:not([hidden])) { grid-template-columns:1fr; } }

/* hero eyebrow — brand indigo instead of the muted grey.
   #2708A0 is the light-mode value; on a dark surface it falls to roughly 1.4:1
   contrast, so dark mode keeps the lighter violet the rest of the site uses
   for indigo accents (cf. .mkt-more in markets.css). */
.nf-eyebrow { font:700 10px/1 var(--font-mono, monospace); letter-spacing:.16em;
  text-transform:uppercase; color:#2708A0; margin-bottom:8px; }
[data-theme="dark"] .nf-eyebrow { color:#a78bfa; }

/* the inline age only exists for phones; desktop keeps its Time column */
.nf-row__age { display:none; }
.nf-row__meta { display:inline; }   /* phones switch this to block, see below */

/* =========================================================================
   PHONES — drop the Time column, fold the age in beside the category
   At 375px the three tracks (110px + 1fr + 150px + 2 gaps) already exceeded
   the ~250px of usable card width, so 1fr collapsed and headlines wrapped one
   word per line while the provider got clipped. Going single-column gives the
   headline the full width back.
   ========================================================================= */
@media (max-width: 639px) {
  .nf-head { display:none; }              /* column headers are meaningless once rows stop being a table */
  .nf-row { grid-template-columns:1fr; gap:5px; padding:11px 13px; }
  .nf-row__t { display:none; }            /* replaced by .nf-row__age inline */
  .nf-row__age { display:inline; margin-right:7px;
    font:600 10.5px/1 var(--font-mono, monospace); color:var(--mxc-muted); white-space:nowrap; }
  /* category + age get their own line so the headline starts fresh below */
  .nf-row__meta { display:block; margin-bottom:3px; line-height:1; }
  .nf-row__p { text-align:left; }         /* reads as a byline under the headline */
}
/* in-app full-article reader body (fetched via /api/article) */
.nfr-p { margin: 0 0 12px; font-size: 14.5px; line-height: 1.72; color: var(--mxc-text, #dfe3ea); }
.nfr-p:last-of-type { margin-bottom: 6px; }
.nfr-orig { display: inline-block; margin-top: 8px; font-size: 12.5px; font-weight: 600; color: var(--mxc-accent, #7aa6ff); text-decoration: none; }
.nfr-orig:hover { text-decoration: underline; }
.nfr-note { margin-top: 10px; font-size: 12.5px; line-height: 1.55; color: var(--mxc-muted, #8a8a9a); }
.nfr-note a { color: var(--mxc-accent, #7aa6ff); font-weight: 600; }

/* ===== full-page in-app article reader (/news/read) ===== */
.nfx-read { max-width: 700px; padding: 22px 0 66px; }
.nfx-read__back { display: inline-block; margin-bottom: 18px; font-size: 13.5px; font-weight: 600; color: var(--mkt-back, var(--mxc-accent, #7aa6ff)); text-decoration: none; }
.nfx-read__back:hover { text-decoration: underline; }
.nfx-read__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.nfx-read__title { font-size: clamp(26px, 4vw, 40px); line-height: 1.16; font-weight: 800; letter-spacing: -.02em; margin: 0 0 14px; color: var(--mxc-text, #eef1f6); }
.nfx-read__meta { font-size: 13.5px; font-weight: 600; color: var(--mxc-muted, #8a8a9a); margin: 0 0 24px; padding-bottom: 18px; border-bottom: 1px solid var(--mxc-line, rgba(255,255,255,.09)); }
.nfx-read__body .nfr-p { font-size: 17.5px; line-height: 1.82; margin: 0 0 20px; color: var(--mxc-text, #dfe3ea); letter-spacing: .001em; }
.nfx-read #nfxOrig { font-size: 14px; margin-top: 8px; }
.nfx-read__disc { margin-top: 30px; padding-top: 16px; border-top: 1px solid var(--mxc-line, rgba(255,255,255,.09)); font-size: 11.5px; line-height: 1.55; color: color-mix(in srgb, var(--mxc-muted, #8a8a9a) 85%, transparent); }
.nfx-read__img { display: block; width: 100%; height: auto; border-radius: 12px; margin: 2px 0 22px; background: var(--mxc-line, rgba(255,255,255,.06)); }

/* ---- reader: Original ⇄ MeritX rewrite switch ---- */
.nfx-seg { display: inline-flex; gap: 2px; padding: 3px; margin: 0 0 16px; border-radius: 10px;
  background: var(--mxc-line, rgba(255,255,255,.07)); }
.nfx-seg__btn { appearance: none; border: 0; cursor: pointer; padding: 7px 15px; border-radius: 8px;
  font: 600 13px/1 "Inter", system-ui, sans-serif; color: var(--mxc-muted, #8a8a9a); background: transparent;
  transition: background .16s ease, color .16s ease; }
.nfx-seg__btn:hover:not(.is-on) { color: var(--mxc-text, #e8ebf0); }
.nfx-seg__btn.is-on { background: var(--mxc-card, #14121d); color: var(--mxc-text, #eef1f6);
  box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.nfx-seg__btn[disabled] { opacity: .55; cursor: default; }
.nfx-read__note { margin: -6px 0 18px; font-size: 12.5px; line-height: 1.55; color: var(--mxc-muted, #8a8a9a); }
.nfx-read__note.is-warn { color: #d08a2c; }

/* ---- article loading skeleton (/news/read) ------------------------------
   The body rewrite takes several seconds, so instead of a spinner (or the old
   "Writing this story…" text) we show the SHAPE of the article that's coming.
   Line height and paragraph rhythm deliberately match `.nfx-read__body .nfr-p`
   (17.5px / 1.82 / 20px gap) so the real text lands without the page jumping.
   Last line of each block is short, the way a real paragraph ends. */
.nfx-skel { animation: nfx-fadein .18s ease-out; }
.nfx-skel__p { margin: 0 0 20px; }
.nfx-skel__l {
  display: block;              /* rendered as <i>, so this is required for height/margin */
  height: 17.5px;
  margin-bottom: 13.5px;
  border-radius: 5px;
  background: linear-gradient(90deg,
    var(--mxc-line, rgba(255,255,255,.07)) 0%,
    color-mix(in srgb, var(--mxc-muted, #8a8a9a) 26%, transparent) 50%,
    var(--mxc-line, rgba(255,255,255,.07)) 100%);
  background-size: 220% 100%;
  animation: nfx-sweep 1.4s ease-in-out infinite;
}
/* stagger the sweep down the page so it reads as one wave, not N blinking bars */
.nfx-skel__p:nth-child(2) .nfx-skel__l { animation-delay: .12s; }
.nfx-skel__p:nth-child(3) .nfx-skel__l { animation-delay: .24s; }
.nfx-skel__p:nth-child(4) .nfx-skel__l { animation-delay: .36s; }
/* ragged right edge — a uniform block reads as a table, not prose */
.nfx-skel__l:nth-child(3n)   { width: 97%; }
.nfx-skel__l:nth-child(3n+1) { width: 100%; }
.nfx-skel__l:nth-child(3n+2) { width: 94%; }
.nfx-skel__l:last-child      { width: 62%; margin-bottom: 0; }

@keyframes nfx-sweep { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
@keyframes nfx-fadein { from { opacity: 0; } to { opacity: 1; } }

/* Respect the OS setting: keep the placeholder, drop the motion. */
@media (prefers-reduced-motion: reduce) {
  .nfx-skel, .nfx-skel__l { animation: none; }
  .nfx-skel__l { background: var(--mxc-line, rgba(255,255,255,.08)); }
}

/* ---- feed loading skeleton (while the AI rewrites the headlines) --------
   Mirrors .nf-row exactly (110px | 1fr, same padding and divider) so the real
   rows land without the table jumping. Reuses the nfx-sweep shimmer from the
   article skeleton so both loading states read as one system. */
.nf-skelrow { display:grid; grid-template-columns:110px 1fr; gap:10px; align-items:center;
  padding:14px 16px; border-top:1px solid var(--mxc-border); }
.nf-skelrow:first-child { border-top:0; }
.nf-skelrow i { display:block; height:12px; border-radius:5px;
  background:linear-gradient(90deg,
    var(--mxc-line, rgba(255,255,255,.07)) 0%,
    color-mix(in srgb, var(--mxc-muted, #8a8a9a) 26%, transparent) 50%,
    var(--mxc-line, rgba(255,255,255,.07)) 100%);
  background-size:220% 100%; animation:nfx-sweep 1.4s ease-in-out infinite; }
.nf-skelrow i:first-child { width:58px; }                 /* the time column */
/* ragged headline widths so it reads as a list of sentences, not a bar chart */
.nf-skelrow:nth-child(3n)   i:last-child { width:72%; }
.nf-skelrow:nth-child(3n+1) i:last-child { width:93%; }
.nf-skelrow:nth-child(3n+2) i:last-child { width:81%; }
/* stagger down the table so the shimmer travels as one wave */
.nf-skelrow:nth-child(2) i { animation-delay:.06s; }
.nf-skelrow:nth-child(3) i { animation-delay:.12s; }
.nf-skelrow:nth-child(4) i { animation-delay:.18s; }
.nf-skelrow:nth-child(5) i { animation-delay:.24s; }
.nf-skelrow:nth-child(6) i { animation-delay:.30s; }
.nf-skelrow:nth-child(7) i { animation-delay:.36s; }
.nf-skelrow:nth-child(8) i { animation-delay:.42s; }

@media (prefers-reduced-motion: reduce) {
  .nf-skelrow i { animation:none; background:var(--mxc-line, rgba(255,255,255,.08)); }
}
@media (max-width:640px) {                                 /* phones drop the time column */
  .nf-skelrow { grid-template-columns:1fr; gap:6px; padding:12px 13px; }
  .nf-skelrow i:first-child { display:none; }
}
