/* ==========================================================================
   Nexa — public news aggregator ("Newswire")
   All styles scoped under .nx to avoid clashing with AppStack / Bootstrap.
   ========================================================================== */

.nx {
    --nx-navy: #1B54AE;
    --nx-navy-deep: #0F2A57;
    --nx-ink: #0F172A;
    --nx-paper: #F4F7F9;
    --nx-surface: #FFFFFF;
    --nx-border: #DEE6ED;
    --nx-muted: #64748B;
    --nx-live: #16A34A;
    --nx-live-bg: #DCFCE7;
    --nx-code-bg: #0F1B2D;
    --nx-code-ink: #E2E8F0;
    --nx-code-accent: #7DD3FC;
    --nx-radius: 14px;
    --nx-shadow: 0 1px 2px rgba(15, 42, 87, .06), 0 8px 24px rgba(15, 42, 87, .06);
    --nx-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

    background: var(--nx-paper);
    color: var(--nx-ink);
    font-family: "Poppins", -apple-system, "Segoe UI", Roboto, sans-serif;
    padding-bottom: 1.5rem;
}

.nx *,
.nx *::before,
.nx *::after {
    box-sizing: border-box;
}

/* Visually-hidden helper (labels) */
.nx-visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --------------------------------------------------------------------------
   Header band
   -------------------------------------------------------------------------- */
.nx-band {
    background: linear-gradient(135deg, var(--nx-navy), var(--nx-navy-deep));
    color: #fff;
    padding: 1.75rem 0 1.5rem;
    box-shadow: 0 12px 32px rgba(15, 42, 87, .18);
    position: relative;
}

.nx-band-inner {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.nx-brand {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.nx-logo {
    height: 44px;
    width: auto;
    display: block;
}

.nx-tagline {
    margin: 0;
    font-size: .82rem;
    color: rgba(255, 255, 255, .82);
    letter-spacing: .01em;
}

/* --------------------------------------------------------------------------
   Filter toolbar (glass)
   -------------------------------------------------------------------------- */
.nx-toolbar {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    background: rgba(255, 255, 255, .12);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: var(--nx-radius);
    padding: .85rem;
}

.nx-field {
    position: relative;
    flex: 1 1 auto;
}

.nx-search-icon {
    position: absolute;
    left: .85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--nx-muted);
    pointer-events: none;
    font-size: .9rem;
}

.nx-input,
.nx-select {
    width: 100%;
    min-height: 44px;
    border: 1px solid rgba(255, 255, 255, .6);
    border-radius: 10px;
    background: rgba(255, 255, 255, .95);
    color: var(--nx-ink);
    padding: .55rem .85rem;
    font-size: .92rem;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
}

.nx-input::placeholder {
    color: var(--nx-muted);
}

.nx-field-search .nx-input {
    padding-left: 2.35rem;
}

.nx-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748B' d='M2 4l4 4 4-4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .85rem center;
    padding-right: 2.2rem;
}

.nx-toolbar-actions {
    display: flex;
    gap: .5rem;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.nx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 44px;
    padding: .55rem 1.1rem;
    border-radius: 10px;
    font-size: .9rem;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
    white-space: nowrap;
}

.nx-btn-primary {
    background: #fff;
    color: var(--nx-navy);
    border-color: #fff;
    flex: 1 1 auto;
}

.nx-btn-primary:hover {
    background: #eef3fb;
    color: var(--nx-navy-deep);
}

.nx-btn-ghost {
    background: transparent;
    color: #fff;
    border-color: rgba(255, 255, 255, .55);
}

.nx-btn-ghost:hover {
    background: rgba(255, 255, 255, .16);
    color: #fff;
}

.nx-btn-outline {
    background: transparent;
    color: var(--nx-navy);
    border-color: var(--nx-navy);
}

.nx-btn-outline:hover {
    background: var(--nx-navy);
    color: #fff;
}

/* --------------------------------------------------------------------------
   Container / sub-bar
   -------------------------------------------------------------------------- */
.nx-container {
    padding-top: 1.25rem;
}

.nx-subbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .85rem;
}

.nx-eyebrow {
    font-family: var(--nx-mono);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--nx-muted);
    font-weight: 600;
    max-width: 60vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nx-subbar-right {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.nx-count {
    font-family: var(--nx-mono);
    font-size: .82rem;
    color: var(--nx-muted);
}

/* --------------------------------------------------------------------------
   Active-filter chips
   -------------------------------------------------------------------------- */
.nx-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin-bottom: 1rem;
}

.nx-chip {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    background: rgba(27, 84, 174, .09);
    color: var(--nx-navy);
    border: 1px solid rgba(27, 84, 174, .2);
    border-radius: 999px;
    padding: .3rem .7rem;
    font-size: .8rem;
    font-weight: 500;
}

.nx-chip-label {
    font-family: var(--nx-mono);
    text-transform: uppercase;
    font-size: .65rem;
    letter-spacing: .08em;
    opacity: .7;
}

.nx-chip-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    color: var(--nx-navy);
    text-decoration: none;
    background: rgba(27, 84, 174, .12);
    line-height: 1;
    font-size: .7rem;
}

.nx-chip-x:hover {
    background: var(--nx-navy);
    color: #fff;
}

/* --------------------------------------------------------------------------
   Source strip (mobile) — horizontal scroll
   -------------------------------------------------------------------------- */
.nx-strip {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    padding-bottom: .6rem;
    margin-bottom: 1rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.nx-strip-pill {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    flex: 0 0 auto;
    background: var(--nx-surface);
    border: 1px solid var(--nx-border);
    border-radius: 999px;
    padding: .35rem .8rem .35rem .4rem;
    color: var(--nx-ink);
    text-decoration: none;
    font-size: .82rem;
    font-weight: 500;
    min-height: 44px;
    white-space: nowrap;
}

.nx-strip-pill .nx-chip-logo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    object-fit: contain;
    padding: 2px;
    border: 1px solid var(--nx-border);
    flex: 0 0 auto;
}

.nx-strip-pill.is-active {
    background: var(--nx-navy);
    border-color: var(--nx-navy);
    color: #fff;
}

.nx-strip-pill:hover {
    border-color: var(--nx-navy);
}

.nx-strip-count {
    font-family: var(--nx-mono);
    font-size: .72rem;
    opacity: .8;
}

/* --------------------------------------------------------------------------
   Source rail (desktop)
   -------------------------------------------------------------------------- */
.nx-rail-col {
    display: none;
}

.nx-rail {
    position: sticky;
    top: 1rem;
    background: var(--nx-surface);
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius);
    padding: .5rem;
    box-shadow: var(--nx-shadow);
}

.nx-rail-title {
    font-family: var(--nx-mono);
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--nx-muted);
    padding: .5rem .6rem;
    margin: 0;
}

.nx-rail-row {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .5rem .6rem;
    border-radius: 10px;
    text-decoration: none;
    color: var(--nx-ink);
    min-height: 44px;
    transition: background-color .12s ease;
}

.nx-rail-row:hover {
    background: rgba(27, 84, 174, .06);
}

.nx-rail-row.is-active {
    background: rgba(27, 84, 174, .09);
    font-weight: 600;
    color: var(--nx-navy-deep);
}

.nx-chip-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #fff;
    object-fit: contain;
    padding: 3px;
    border: 1px solid var(--nx-border);
    flex: 0 0 auto;
}

.nx-rail-all .nx-rail-allicon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(27, 84, 174, .08);
    color: var(--nx-navy);
    flex: 0 0 auto;
}

.nx-rail-name {
    flex: 1 1 auto;
    font-size: .88rem;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nx-rail-count {
    font-family: var(--nx-mono);
    font-size: .72rem;
    color: var(--nx-muted);
    background: var(--nx-paper);
    border-radius: 999px;
    padding: .1rem .5rem;
    flex: 0 0 auto;
}

.nx-rail-row.is-active .nx-rail-count {
    background: rgba(27, 84, 174, .14);
    color: var(--nx-navy);
}

/* --------------------------------------------------------------------------
   Card grid
   -------------------------------------------------------------------------- */
.nx-cards {
    --bs-gutter-x: 2rem;
    --bs-gutter-y: 2rem;
}

.nx-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--nx-surface);
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius);
    box-shadow: var(--nx-shadow);
    padding: 1.1rem 1.1rem 1rem;
    transition: transform .18s ease, box-shadow .18s ease;
}

.nx-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(15, 42, 87, .08), 0 16px 36px rgba(15, 42, 87, .12);
}

.nx-card-title {
    font-size: 1rem;
    line-height: 1.35;
    margin: 0 0 .6rem;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.nx-card-title a {
    color: var(--nx-navy-deep);
    text-decoration: none;
}

.nx-card-title a:hover {
    color: var(--nx-navy);
    text-decoration: underline;
}

.nx-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    margin-bottom: .6rem;
}

.nx-badge-source {
    background: var(--nx-navy);
    color: #fff;
    font-size: .68rem;
    font-weight: 600;
    border-radius: 6px;
    padding: .2rem .5rem;
    letter-spacing: .01em;
}

.nx-date {
    font-family: var(--nx-mono);
    font-size: .72rem;
    color: var(--nx-muted);
}

.nx-lang {
    font-size: .66rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--nx-muted);
    background: var(--nx-paper);
    border: 1px solid var(--nx-border);
    border-radius: 999px;
    padding: .12rem .5rem;
}

.nx-keyword {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    align-self: flex-start;
    font-size: .7rem;
    color: var(--nx-navy);
    background: rgba(27, 84, 174, .08);
    border: 1px solid rgba(27, 84, 174, .16);
    border-radius: 999px;
    padding: .15rem .55rem;
    margin-bottom: .6rem;
}

.nx-keyword i {
    font-size: .62rem;
    opacity: .8;
}

.nx-snippet {
    color: var(--nx-muted);
    font-size: .86rem;
    line-height: 1.55;
    margin: 0 0 .8rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.nx-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-top: auto;
    padding-top: .25rem;
}

.nx-more {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--nx-navy);
    font-size: .82rem;
    font-weight: 600;
    text-decoration: none;
}

.nx-more:hover {
    text-decoration: underline;
}

.nx-more i {
    font-size: .72rem;
}

.nx-card-logo {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    background: #fff;
    object-fit: contain;
    padding: 2px;
    border: 1px solid var(--nx-border);
    flex: 0 0 auto;
}

/* Text monogram shown when a source has no same-origin logo image. */
.nx-mono {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: rgba(27, 84, 174, .08);
    color: var(--nx-navy);
    font-family: var(--nx-mono);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    overflow: hidden;
}

.nx-card-logo.nx-mono {
    font-size: 11px;
}

/* --------------------------------------------------------------------------
   Empty state
   -------------------------------------------------------------------------- */
.nx-empty {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--nx-surface);
    border: 1px dashed var(--nx-border);
    border-radius: var(--nx-radius);
}

.nx-empty i {
    font-size: 2.5rem;
    color: var(--nx-border);
    margin-bottom: 1rem;
}

.nx-empty-msg {
    color: var(--nx-ink);
    font-weight: 600;
    margin: 0 0 .35rem;
}

.nx-empty-sub {
    color: var(--nx-muted);
    font-size: .88rem;
    margin: 0 0 1.25rem;
}

/* --------------------------------------------------------------------------
   Pagination (Bootstrap override)
   -------------------------------------------------------------------------- */
.nx-pagination {
    margin-top: .5rem;
}

.nx .pagination {
    flex-wrap: wrap;
    gap: .25rem;
}

.nx .page-link {
    color: var(--nx-navy);
    border-color: var(--nx-border);
    border-radius: 8px;
    min-width: 40px;
    text-align: center;
}

/* Bootstrap rounds only the outer corners of the first/last items; the Nexa
   pagination uses separated pills, so keep every button uniformly rounded. */
.nx .page-item:first-child .page-link,
.nx .page-item:last-child .page-link {
    border-radius: 8px;
}

.nx .page-link:hover {
    background: rgba(27, 84, 174, .08);
    color: var(--nx-navy-deep);
}

.nx .page-item.active .page-link {
    background: var(--nx-navy);
    border-color: var(--nx-navy);
    color: #fff;
}

.nx .page-item.disabled .page-link {
    color: var(--nx-muted);
}

/* --------------------------------------------------------------------------
   Embed modal / terminal code panel
   -------------------------------------------------------------------------- */
.nx-modal-explainer {
    color: var(--nx-muted);
    font-size: .9rem;
    margin-bottom: 1rem;
}

.nx-dim-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.nx-dim-field {
    flex: 1 1 120px;
}

.nx-dim-field label {
    display: block;
    font-family: var(--nx-mono);
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--nx-muted);
    margin-bottom: .3rem;
}

.nx-dim-input {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--nx-border);
    border-radius: 10px;
    padding: .5rem .75rem;
    font-size: .9rem;
    font-family: inherit;
    color: var(--nx-ink);
    background: #fff;
}

.nx-codeblock {
    background: var(--nx-code-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(15, 27, 45, .35);
}

.nx-codeblock-bar {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem .85rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.nx-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    display: inline-block;
}

.nx-dot-r { background: #ff5f56; }
.nx-dot-y { background: #ffbd2e; }
.nx-dot-g { background: #27c93f; }

.nx-codeblock-title {
    margin-left: .5rem;
    font-family: var(--nx-mono);
    font-size: .7rem;
    color: rgba(226, 232, 240, .55);
}

.nx-codeblock pre {
    margin: 0;
    padding: 1rem 1.1rem;
    overflow-x: auto;
}

.nx-codeblock code {
    font-family: var(--nx-mono);
    font-size: .8rem;
    line-height: 1.7;
    color: var(--nx-code-ink);
    white-space: pre;
}

.nx-tok {
    color: var(--nx-code-accent);
}

.nx-tok-attr {
    color: #a5b4fc;
}

.nx-tok-str {
    color: #86efac;
}

.nx-copy-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
}

.nx-copy-btn.is-copied {
    background: var(--nx-live-bg);
    color: var(--nx-live);
    border-color: var(--nx-live);
}

/* --------------------------------------------------------------------------
   Focus visibility
   -------------------------------------------------------------------------- */
.nx a:focus-visible,
.nx button:focus-visible,
.nx input:focus-visible,
.nx select:focus-visible,
.nx .page-link:focus-visible {
    outline: 2px solid var(--nx-navy);
    outline-offset: 2px;
}

.nx-band a:focus-visible,
.nx-band button:focus-visible,
.nx-band input:focus-visible,
.nx-band select:focus-visible {
    outline-color: #fff;
}

/* --------------------------------------------------------------------------
   Breakpoints
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
    .nx-toolbar {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .nx-field-search {
        flex: 2 1 260px;
    }

    .nx-field-select {
        flex: 1 1 160px;
    }

    .nx-toolbar-actions {
        flex: 0 0 auto;
    }

    .nx-btn-primary {
        flex: 0 0 auto;
    }
}

@media (min-width: 992px) {
    .nx-band {
        border-bottom-left-radius: 24px;
        border-bottom-right-radius: 24px;
        padding: 2.25rem 0 2rem;
    }

    .nx-logo {
        height: 64px;
    }

    .nx-strip {
        display: none;
    }

    .nx-rail-col {
        display: block;
    }
}

@media (min-width: 1200px) {
    .nx-band {
        padding: 2.75rem 0 2.25rem;
    }
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .nx *,
    .nx *::before,
    .nx *::after {
        transition: none !important;
        animation: none !important;
    }

    .nx-card:hover {
        transform: none;
    }
}
