/* Netwise RSS News Cards — all selectors are scoped to .nfc */
.nfc { --nfc-accent: #0876ab; --nfc-border: #e0e5eb; --nfc-text: #172b3d; --nfc-muted: #637487; color: var(--nfc-text); }
.nfc *, .nfc *::before, .nfc *::after { box-sizing: border-box; }
.nfc-filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 24px; }
.nfc-filter { cursor: pointer; border: 1px solid var(--nfc-border); background: #fff; color: var(--nfc-text); border-radius: 999px; padding: 8px 15px; font: inherit; font-size: .88rem; line-height: 1.3; transition: background .15s, color .15s, border-color .15s; }
.nfc-filter:hover, .nfc-filter:focus-visible { border-color: var(--nfc-accent); }
.nfc-filter.is-active { background: var(--nfc-text); color: white; border-color: var(--nfc-text); }
.nfc-grid { display: grid; grid-template-columns: repeat(var(--nfc-cols-mobile, 1), minmax(0, 1fr)); gap: var(--nfc-gap, 20px); align-items: stretch; }
.nfc-card { min-width: 0; overflow: hidden; display: flex; flex-direction: column; border: 1px solid var(--nfc-border); background: #fff; border-radius: 12px; box-shadow: 0 3px 16px rgba(15, 35, 57, .06); transition: transform .16s ease, box-shadow .16s ease; }
.nfc-card:hover { transform: translateY(-2px); box-shadow: 0 7px 22px rgba(15, 35, 57, .11); }
.nfc-card[hidden], .nfc-no-results[hidden] { display: none !important; }
.nfc-image { display: block; width: 100%; aspect-ratio: var(--nfc-image-ratio, 16/9); background: #edf3f8; overflow: hidden; position: relative; color: #94a7b8; }
.nfc-image img { display: block; width: 100%; height: 100%; object-fit: cover; position: relative; z-index: 1; }
.nfc-image img[hidden] { display: none !important; }
.nfc-image-placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.nfc-card-body { display: flex; flex: 1 1 auto; flex-direction: column; gap: 11px; min-width: 0; padding: 20px; }
.nfc-card-category { color: var(--nfc-accent); font-weight: 700; text-transform: uppercase; letter-spacing: .035em; font-size: .72rem; overflow-wrap: anywhere; }
.nfc-card-title { margin: 0; font-size: 1.13rem; font-weight: 700; line-height: 1.38; overflow-wrap: anywhere; }
.nfc-card-title a { text-decoration: none; color: inherit; }
.nfc-card-title a:hover { color: var(--nfc-accent); }
.nfc-card-excerpt { margin: 0; color: var(--nfc-muted); font-size: .92rem; line-height: 1.55; overflow-wrap: anywhere; }
.nfc-card-meta { display: flex; gap: 7px 14px; flex-wrap: wrap; color: var(--nfc-muted); font-size: .78rem; line-height: 1.4; margin-top: auto; }
.nfc-card-link { margin-top: 5px; color: var(--nfc-accent); font-size: .88rem; font-weight: 700; text-decoration: none; align-self: flex-start; }
.nfc-card-link:hover, .nfc-card-link:focus-visible { text-decoration: underline; }
.nfc-empty, .nfc-no-results { padding: 20px 0; color: var(--nfc-muted); }
.nfc a:focus-visible, .nfc button:focus-visible { outline: 3px solid var(--nfc-accent); outline-offset: 3px; }
@media (min-width: 576px) { .nfc-grid { grid-template-columns: repeat(var(--nfc-cols-large-mobile, 2), minmax(0, 1fr)); } }
@media (min-width: 768px) { .nfc-grid { grid-template-columns: repeat(var(--nfc-cols-tablet, 2), minmax(0, 1fr)); } }
@media (min-width: 992px) { .nfc-grid { grid-template-columns: repeat(var(--nfc-cols-desktop, 3), minmax(0, 1fr)); } }
@media (min-width: 1200px) { .nfc-grid { grid-template-columns: repeat(var(--nfc-cols-large-desktop, 4), minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) { .nfc-card, .nfc-filter { transition: none; } }

.nfc-diagnostics { border: 1px solid #b2c7d5; border-radius: 8px; padding: 12px 16px; background: #eef5fa; color: #18394f; margin-bottom: 18px; font-size: 0.85rem; }
.nfc-diagnostics ul { margin: 6px 0 0 20px; padding: 0; }

/* Diagnostics are opt-in and styled separately from news cards. */
.nfc-diagnostics { border: 1px solid #a6bdcc; border-radius: 10px; padding: 16px; background: #f2f7fb; color: #19364d; margin: 0 0 20px; line-height: 1.5; font-size: .86rem; overflow-wrap: anywhere; }
.nfc-debug-header { display: flex; justify-content: space-between; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.nfc-debug-header span { color: #9d3a15; font-weight: 650; }
.nfc-debug-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 7px 20px; margin: 0 0 12px; }
.nfc-debug-notice { border-left: 3px solid #b05a12; padding-left: 10px; }
.nfc-debug-source { border-top: 1px solid #d3e1e8; padding: 9px 0; }
.nfc-debug-source summary { cursor: pointer; }
.nfc-debug-source dl { display: grid; grid-template-columns: minmax(135px, 200px) 1fr; gap: 5px 15px; margin: 10px 0 0; }
.nfc-debug-source dt { font-weight: bold; }
.nfc-debug-source dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width:575px) { .nfc-debug-source dl { grid-template-columns: 1fr; gap: 3px; } }

/* Nested RSS category filtering */
.nfc-subfilters { display: flex; flex-wrap: wrap; gap: 8px; margin: -10px 0 24px; padding-left: 10px; border-left: 3px solid var(--nfc-border); }
.nfc-subfilters[hidden] { display: none !important; }
.nfc-subfilter { font-size: .81rem; padding: 6px 11px; }

/* v1.0.9 Three selectable layouts; all styles scoped to a single module. */
.nfc {
  --nfc-card-bg: #fff;
  --nfc-radius: 12px;
}
.nfc .nfc-card {
  background: var(--nfc-card-bg);
  border-radius: var(--nfc-radius);
}
.nfc .nfc-card-link { color: var(--nfc-accent); }
.nfc .nfc-card-category { display: flex; gap: 4px; align-items: baseline; flex-wrap: wrap; }
.nfc .nfc-category-subs { color: var(--nfc-muted); text-transform: none; font-weight: 600; letter-spacing: 0; }
.nfc .nfc-card-link-button {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--nfc-accent); border-radius: 6px;
  background: var(--nfc-accent); color: white;
  padding: 8px 14px; line-height: 1.3; text-decoration: none;
}
.nfc .nfc-card-link-button:hover,
.nfc .nfc-card-link-button:focus-visible { text-decoration: none; background: transparent; color: var(--nfc-accent); }
.nfc-finish-border .nfc-card,
.nfc-finish-border .nfc-card:hover { box-shadow: none; }
.nfc-finish-plain .nfc-card,
.nfc-finish-plain .nfc-card:hover { border-color: transparent; box-shadow: none; }
.nfc-finish-plain .nfc-card:hover { transform: none; }

/* Editorial list: image and information side-by-side, optional image right. */
.nfc-layout-editorial .nfc-grid { grid-template-columns: 1fr; }
.nfc-layout-editorial .nfc-card {
  display: grid; grid-template-areas: 'image content';
  grid-template-columns: minmax(0, 36%) minmax(0, 1fr);
  align-items: stretch;
}
.nfc-layout-editorial.nfc-image-right .nfc-card {
  grid-template-areas: 'content image';
  grid-template-columns: minmax(0, 1fr) minmax(0, 36%);
}
.nfc-layout-editorial .nfc-image {
  grid-area: image; height: 100%; min-height: 160px; aspect-ratio: auto;
}
.nfc-layout-editorial .nfc-card-body { grid-area: content; padding: 20px; gap: 9px; }
.nfc-layout-editorial .nfc-card-meta { margin-top: 0; }
.nfc-layout-editorial .nfc-card-link { margin-top: auto; }
@media (min-width: 992px) {
  .nfc-layout-editorial .nfc-grid { grid-template-columns: repeat(var(--nfc-editorial-cols, 1), minmax(0, 1fr)); }
}
@media (max-width: 575px) {
  .nfc-layout-editorial .nfc-card,
  .nfc-layout-editorial.nfc-image-right .nfc-card {
    grid-template-areas: 'image' 'content'; grid-template-columns: 1fr;
  }
  .nfc-layout-editorial .nfc-image { height: auto; min-height: 0; aspect-ratio: var(--nfc-image-ratio, 16/9); }
}

/* Magazine: first visible story is prominent, remaining articles use the same card vocabulary. */
.nfc-layout-magazine .nfc-grid { grid-template-columns: repeat(var(--nfc-cols-mobile, 1), minmax(0, 1fr)); }
@media (min-width: 576px) {
  .nfc-layout-magazine .nfc-grid { grid-template-columns: repeat(var(--nfc-cols-large-mobile, 2), minmax(0, 1fr)); }
}
.nfc-layout-magazine .nfc-featured .nfc-card-title { font-size: clamp(1.3rem, 2.4vw, 1.8rem); }
.nfc-layout-magazine .nfc-featured .nfc-card-body { gap: 13px; }
@media (min-width: 768px) {
  .nfc-layout-magazine .nfc-grid { grid-template-columns: repeat(var(--nfc-cols-tablet, 2), minmax(0, 1fr)); }
  .nfc-layout-magazine .nfc-featured { grid-column: 1 / -1; }
  .nfc-layout-magazine .nfc-featured .nfc-image { aspect-ratio: 16/8; }
}
@media (min-width: 992px) {
  .nfc-layout-magazine .nfc-grid { grid-template-columns: repeat(var(--nfc-cols-desktop, 3), minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
  .nfc-layout-magazine .nfc-grid { grid-template-columns: repeat(var(--nfc-cols-large-desktop, 4), minmax(0, 1fr)); }
}

/* v1.0.10: independently place category, subcategory and date without changing card presets. */
.nfc .nfc-card-strap {
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; gap: 4px 12px; min-width: 0;
}
.nfc .nfc-card-strap .nfc-card-category { min-width: 0; flex: 1 1 auto; }
.nfc .nfc-card-strap .nfc-card-date {
  margin-left: auto; text-align: right; color: var(--nfc-muted);
  font-size: .78rem; font-weight: 400; line-height: 1.4;
}


/* v1.0.11: consistent card footers in all three layouts. */
.nfc .nfc-card-body { height: 100%; }
.nfc .nfc-card-meta { margin-top: 0; }
.nfc .nfc-card-footer { width: 100%; min-width: 0; }
.nfc .nfc-footer-bottom { margin-top: auto; }
.nfc .nfc-footer-divider { border-top: 1px solid var(--nfc-border); }
.nfc .nfc-footer-padding-small { padding-top: 8px; }
.nfc .nfc-footer-padding-medium { padding-top: 15px; }
.nfc .nfc-footer-padding-large { padding-top: 24px; }
.nfc .nfc-card-footer .nfc-card-link { display: inline-flex; align-items: center; margin-top: 0; }
.nfc-layout-editorial .nfc-card-footer .nfc-card-link { margin-top: 0; }

/* Custom heading, actual last successful feed check, and a user-initiated refresh. */
.nfc .nfc-section-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 9px 22px; margin-bottom: 20px; }
.nfc .nfc-section-title { margin: 0; line-height: 1.25; font-size: clamp(1.3rem, 2.4vw, 1.9rem); font-weight: 700; color: var(--nfc-text); }
.nfc .nfc-section-updated { display: flex; align-items: center; gap: 7px; min-width: 0; color: var(--nfc-muted); font-size: .83rem; }
.nfc .nfc-updated-label { white-space: normal; }
.nfc .nfc-refresh { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; border: 1px solid var(--nfc-border); color: var(--nfc-accent); background: var(--nfc-card-bg); border-radius: 50%; cursor: pointer; padding: 6px; }
.nfc .nfc-refresh:hover { background: #edf3f8; }
.nfc .nfc-refresh:disabled { cursor: progress; opacity: .6; }
.nfc .nfc-refresh.is-loading svg { animation: nfc-spin .9s linear infinite; }
.nfc .nfc-refresh-status:empty { display: none; }
.nfc .nfc-refresh-status { font-size: .76rem; max-width: 220px; overflow-wrap: anywhere; }
@keyframes nfc-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion:reduce) { .nfc .nfc-refresh.is-loading svg { animation: none; } }

/* Opt-in stacked category labels keep the right-aligned date clear even in narrow cards. */
.nfc .nfc-card-strap { align-items: flex-start; }
.nfc .nfc-card-strap .nfc-card-category { min-width: 0; flex: 1 1 0; }
.nfc .nfc-card-strap .nfc-card-date { white-space: nowrap; flex: 0 0 auto; }
.nfc .nfc-card-category.nfc-category-stacked { display: flex; flex-direction: column; flex-wrap: nowrap; align-items: flex-start; gap: 2px; }
.nfc .nfc-category-stacked .nfc-category-separator { display: none; }
.nfc .nfc-category-stacked .nfc-category-subs { overflow-wrap: anywhere; }

/* v1.0.12: full-width stacked subcategories. The date never constrains their row. */
.nfc .nfc-card-strap.nfc-strap-stacked { display: grid; grid-template-columns: minmax(0, 1fr) max-content; gap: 2px 12px; align-items: start; }
.nfc .nfc-strap-stacked .nfc-card-category { display: contents; }
.nfc .nfc-strap-stacked .nfc-category-main { grid-column: 1; grid-row: 1; min-width: 0; color: var(--nfc-accent); overflow-wrap: anywhere; }
.nfc .nfc-strap-stacked .nfc-category-subs { grid-column: 1 / -1; grid-row: 2; min-width: 0; width: 100%; color: var(--nfc-muted); overflow-wrap: anywhere; white-space: normal; }
.nfc .nfc-strap-stacked .nfc-card-date { grid-column: 2; grid-row: 1; margin-left: 0; text-align: right; white-space: nowrap; }
/* Height controls crop safely rather than distort the image. */
.nfc.nfc-image-height-fixed:not(.nfc-layout-editorial) .nfc-card .nfc-image { height: var(--nfc-image-height, 240px); flex: 0 0 var(--nfc-image-height, 240px); aspect-ratio: auto; }
.nfc.nfc-image-height-fixed.nfc-layout-editorial .nfc-card .nfc-image { min-height: var(--nfc-image-height, 240px); }
@media (max-width:575px) { .nfc.nfc-image-height-fixed.nfc-layout-editorial .nfc-card .nfc-image { height: var(--nfc-image-height, 240px); min-height: 0; aspect-ratio: auto; } }
.nfc.nfc-image-height-fixed.nfc-layout-magazine .nfc-featured .nfc-image { aspect-ratio: auto; }
/* Compact cards still stretch to equal row heights and keep footers aligned. */
.nfc.nfc-density-compact .nfc-card-body, .nfc.nfc-density-compact.nfc-layout-editorial .nfc-card-body { padding: 16px; gap: 7px; }
.nfc.nfc-density-regular .nfc-card-body, .nfc.nfc-density-regular.nfc-layout-editorial .nfc-card-body { padding: 20px; gap: 11px; }
.nfc.nfc-density-spacious .nfc-card-body, .nfc.nfc-density-spacious.nfc-layout-editorial .nfc-card-body { padding: 24px; gap: 14px; }
.nfc.nfc-density-compact .nfc-card-footer { padding-top: 8px; }
/* Footer auto margin remains intact in compact mode. */
.nfc.nfc-clamp-intro .nfc-card-excerpt { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--nfc-intro-lines, 3); line-clamp: var(--nfc-intro-lines, 3); overflow: hidden; }
.nfc.nfc-clamp-title .nfc-card-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--nfc-title-lines, 3); line-clamp: var(--nfc-title-lines, 3); overflow: hidden; }
/* The editorial layout's action link is positioned by its footer, not directly. */
.nfc-layout-editorial .nfc-card-link { margin-top: 0; }
/* Lazy page controls (scoped per instance). */
.nfc .nfc-pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; margin: 24px 0 4px; }
.nfc .nfc-page-count { color: var(--nfc-muted); font-size: .85rem; }
.nfc .nfc-load-more { border: 1px solid var(--nfc-accent); border-radius: 6px; background: var(--nfc-accent); color: #fff; font: inherit; font-size: .91rem; font-weight: 600; padding: 11px 20px; cursor: pointer; }
.nfc .nfc-load-more:hover { filter: brightness(.92); }
.nfc .nfc-load-more:disabled { opacity: .6; cursor: progress; }
.nfc .nfc-page-buttons { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.nfc .nfc-page-buttons button { min-width: 36px; min-height: 36px; padding: 5px 8px; background: var(--nfc-card-bg); border: 1px solid var(--nfc-border); border-radius: 6px; color: var(--nfc-text); cursor: pointer; }
.nfc .nfc-page-buttons button[aria-current="page"] { background: var(--nfc-accent); border-color: var(--nfc-accent); color: #fff; font-weight: 700; cursor: default; }
.nfc .nfc-page-buttons button:hover:not([disabled]) { border-color: var(--nfc-accent); }
.nfc .nfc-page-status { margin: 6px 0; color: var(--nfc-muted); font-size: .82rem; }
.nfc .nfc-page-status:empty { display: none; }
/* With fixed image heights, avoid height:100% on the flex child. It prevents
   auto-margin footers from consuming remaining space consistently. */
.nfc .nfc-card-body { height: auto; }

/* Beta 16: animated full-viewport news loader, not a static card-sized panel. */
.nfc-preloader[hidden] { display: none !important; }
.nfc-preloader, .nfc-preloader-initial {
  position: fixed !important; z-index: 2147483000; inset: 0 !important;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; margin: 0; width: 100vw; min-height: 100dvh;
  box-sizing: border-box; border: 0; border-radius: 0;
  background: rgba(8, 22, 38, .70); backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px); color: #172b3d;
}
.nfc-loader-dialog {
  position: relative; isolation: isolate; overflow: hidden; width: min(560px, 100%);
  min-height: 255px; box-sizing: border-box; border-radius: 16px;
  background: #f5faff; border: 1px solid rgba(255,255,255,.85);
  box-shadow: 0 20px 80px rgba(0,0,0,.27);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 35px 24px 26px; text-align: center;
}
.nfc-news-backdrop { position: absolute; inset: 0; overflow: hidden; pointer-events: none;
  background: linear-gradient(100deg, #f5faff 0%, #dfedf7 38%, #f5faff 70%);
  background-size: 240% 100%; animation: nfc-news-shimmer 2.5s linear infinite;
}
.nfc-news-rail { position: absolute; height: 4px; width: 130%; left: -15%;
  background: repeating-linear-gradient(90deg, transparent 0 13px, var(--nfc-accent,#0876ab) 13px 68px, transparent 68px 91px);
  opacity: .13; animation: nfc-news-ticker 6s linear infinite;
}
.nfc-rail-first { top: 16%; animation-duration: 5.8s; }
.nfc-rail-second { top: 51%; animation-duration: 7.5s; animation-direction: reverse; opacity: .08; }
.nfc-rail-third { top: 82%; animation-duration: 6.7s; }
.nfc-news-signal { position: absolute; top: 31px; left: calc(50% - 33px);
  width: 66px; height: 66px; display: flex; align-items: center; justify-content: center;
  color: var(--nfc-accent,#0876ab); background: white; border: 2px solid #afd3e7;
  border-radius: 50%; animation: nfc-news-pulse 1.7s ease-out infinite;
  box-shadow: 0 0 0 0 rgba(8,118,171,.20);
}
.nfc-news-signal svg { width: 41px; height: 41px; }
.nfc-preloader-title { position: relative; z-index: 1; margin: 88px 0 14px;
  font: inherit; font-size: 1rem; font-weight: 700; color: #172b3d; letter-spacing: .015em;
}
.nfc-preloader-dots { display: inline-block; animation: nfc-news-dots 1.3s ease-in-out infinite; }
.nfc-loader-progress { position: relative; width: min(280px, 100%); height: 5px;
  overflow: hidden; border-radius: 999px; background: #cee1ec; }
.nfc-loader-progress span { position: absolute; height: 100%; width: 32%; left: 0;
  background: var(--nfc-accent,#0876ab); border-radius: inherit;
  animation: nfc-loader-sweep 1.25s ease-in-out infinite alternate; }
.nfc.nfc-is-loading > :not(.nfc-preloader):not(.nfc-section-header) { opacity: 1; }
@keyframes nfc-news-ticker { from { transform: translateX(-9%); } to { transform: translateX(13%); } }
@keyframes nfc-news-shimmer { from { background-position: 150% 0; } to { background-position: -150% 0; } }
@keyframes nfc-news-pulse { 0% { box-shadow: 0 0 0 0 rgba(8,118,171,.25); transform:scale(.98); } 70%,100% { box-shadow: 0 0 0 20px rgba(8,118,171,0); transform:scale(1.05); } }
@keyframes nfc-news-dots { 0%,100% { opacity:.15; } 50% { opacity: 1; } }
@keyframes nfc-loader-sweep { from { transform: translateX(-30%); } to { transform: translateX(235%); } }
@media (prefers-reduced-motion: reduce) {
  .nfc-news-backdrop, .nfc-news-rail, .nfc-news-signal,
  .nfc-preloader-dots, .nfc-loader-progress span { animation: none !important; }
  .nfc-loader-progress span { width: 50%; transform: none; }
}
/* Let the Load More action indicate progress even when the top overlay has scrolled away. */
.nfc .nfc-load-more:disabled { opacity:.72; cursor:progress; }
.nfc .nfc-load-more:disabled::after {
  content:""; display:inline-block; width:11px; height:11px; margin-left:9px; vertical-align:-1px;
  border:2px solid currentColor; border-top-color:transparent; border-radius:50%; animation:nfc-button-wait .7s linear infinite;
}
@keyframes nfc-button-wait { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .nfc .nfc-load-more:disabled::after { animation:none; } }

.nfc .nfc-initial-status { text-align:center; margin:0 auto 24px; }
.nfc .nfc-try-again { font:inherit; border:1px solid var(--nfc-accent,#0876ab);
  color:var(--nfc-accent,#0876ab); background:#fff; padding:9px 14px; border-radius:7px; cursor:pointer; }
.nfc .nfc-try-again[hidden] { display:none!important; }
