/* ============================================================
   News — trending headlines + in-place full-article reader.
   Shares the dark, aurora, indigo/violet look of the app.
   ============================================================ */
* { box-sizing: border-box; }

:root {
    --bg: #07080f;
    --card: rgba(255, 255, 255, 0.035);
    --card-brd: rgba(255, 255, 255, 0.08);
    --ink: #e8eaf2;
    --ink-dim: #b6bacb;
    --ink-faint: #7a8098;
    --indigo: #6366f1;
    --violet: #8b5cf6;
    --sky: #38bdf8;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Inter", system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.aurora {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(60vw 40vh at 15% 0%, rgba(99, 102, 241, 0.18), transparent 60%),
        radial-gradient(50vw 40vh at 90% 10%, rgba(139, 92, 246, 0.14), transparent 60%),
        radial-gradient(40vw 30vh at 50% 100%, rgba(56, 189, 248, 0.08), transparent 60%);
    filter: saturate(1.1);
}

/* ---- header ---- */
.top {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(8, 9, 16, 0.6);
    backdrop-filter: blur(8px);
}
.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
    color: var(--ink);
    font-weight: 700;
    font-size: 18px;
}
.brand b { color: var(--violet); font-weight: 800; }
.brand-mark {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--indigo), var(--violet));
    box-shadow: 0 0 18px rgba(124, 92, 255, 0.5);
}
.brand-tag {
    color: var(--ink-faint);
    font-size: 11px;
    font-weight: 600;
    border: 1px solid var(--card-brd);
    padding: 2px 8px;
    border-radius: 999px;
    letter-spacing: 0.02em;
}
.top-nav { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.oc-link {
    color: var(--ink-dim);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 12px;
    border-radius: 9px;
    border: 1px solid transparent;
    white-space: nowrap;
}
.oc-link:hover { background: rgba(255, 255, 255, 0.06); color: var(--ink); }

/* ---- layout ---- */
.wrap {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1720px;
    margin: 0 auto;
    padding: 26px clamp(20px, 4vw, 56px) 80px;
}
.hero { margin-bottom: 18px; }
.hero-title {
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 800;
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}
.hero-title .g {
    background: linear-gradient(120deg, var(--indigo), var(--violet), var(--sky));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero-sub {
    color: var(--ink-dim);
    max-width: 720px;
    line-height: 1.6;
    margin: 0;
    font-size: 15px;
}
.hero-sub b { color: var(--ink); font-weight: 600; }

/* ---- category tabs (sticky segmented bar) ---- */
.nw-tabs {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 18px 0 14px;
    padding: 9px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(11, 13, 24, 0.72);
    backdrop-filter: blur(16px) saturate(1.3);
    -webkit-backdrop-filter: blur(16px) saturate(1.3);
    box-shadow: 0 14px 40px -22px rgba(0, 0, 0, 0.9),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.nw-tabs::-webkit-scrollbar { display: none; }
.nw-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 0 0 auto;
    padding: 10px 18px;
    border-radius: 11px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink-dim);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, box-shadow 0.2s ease;
}
.nw-tab:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
.nw-tab .ic { font-size: 16px; line-height: 1; }
.nw-tab.on {
    color: #fff;
    background: linear-gradient(135deg, var(--indigo), var(--violet));
    box-shadow: 0 8px 22px -6px rgba(99, 102, 241, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.nw-catnote {
    color: var(--ink-faint);
    font-size: 13px;
    margin: 2px 0 16px;
    min-height: 18px;
}
.nw-status {
    color: var(--ink-dim);
    font-size: 14px;
    padding: 30px 0;
    text-align: center;
}
.nw-status.err { color: #fca5a5; }

/* ---- headline grid ---- */
.nw-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.nw-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--card-brd);
    background: var(--card);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    text-align: left;
    padding: 0;
    color: inherit;
    font: inherit;
}
.nw-card:hover {
    transform: translateY(-3px);
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}
.nw-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(139, 92, 246, 0.18));
    overflow: hidden;
}
.nw-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.nw-thumb-ph {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    opacity: 0.55;
}
.nw-src {
    position: absolute;
    left: 10px;
    bottom: 10px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(8, 9, 16, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--ink);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
    backdrop-filter: blur(4px);
}
.nw-body { padding: 14px 15px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.nw-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    margin: 0;
    letter-spacing: -0.01em;
}
.nw-sum {
    color: var(--ink-dim);
    font-size: 13.5px;
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.nw-meta {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-faint);
    font-size: 12px;
    font-weight: 500;
}
.nw-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-faint); }
.nw-read { color: var(--violet); font-weight: 700; margin-left: auto; }

/* ---- load more ---- */
.nw-more { display: flex; justify-content: center; margin: 26px 0 4px; }
.nw-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 22px;
    border-radius: 999px;
    border: 1px solid var(--card-brd);
    background: var(--card);
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}
.nw-more-btn:hover {
    border-color: rgba(139, 92, 246, 0.5);
    background: rgba(139, 92, 246, 0.1);
    transform: translateY(-1px);
}
.nw-more-n {
    color: var(--ink-faint);
    font-weight: 600;
    font-size: 12px;
    border-left: 1px solid var(--card-brd);
    padding-left: 10px;
}
.nw-more-end {
    color: var(--ink-faint);
    font-size: 13px;
    padding: 8px 0;
}

/* skeleton loading */
.nw-skel { pointer-events: none; }
.nw-skel .nw-thumb,
.nw-skel .nw-line {
    background: linear-gradient(100deg, rgba(255,255,255,0.04) 30%, rgba(255,255,255,0.09) 50%, rgba(255,255,255,0.04) 70%);
    background-size: 200% 100%;
    animation: nw-shimmer 1.3s infinite;
}
.nw-skel .nw-line { height: 12px; border-radius: 6px; margin: 6px 0; }
.nw-skel .nw-line.w70 { width: 70%; }
.nw-skel .nw-line.w40 { width: 40%; }
@keyframes nw-shimmer { to { background-position: -200% 0; } }

/* ---- reader overlay ---- */
.nw-reader {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
}
.nw-reader.open { display: block; }
/* When the sidebar is docked open on desktop, start the reader (backdrop
   + panel) just past it so it sits BESIDE the nav, not underneath it. */
@media (min-width: 1100px) {
    body.nav-open .nw-reader { left: var(--sb-w); }
}
.nw-reader-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 5, 12, 0.72);
    backdrop-filter: blur(6px);
}
.nw-reader-panel {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: min(1180px, 82vw);
    max-width: 100%;
    background: #0b0d18;
    border-left: 1px solid var(--card-brd);
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    animation: nw-slide 0.25s ease;
}
@keyframes nw-slide { from { transform: translateX(30px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.nw-reader-close {
    position: sticky;
    top: 12px;
    float: right;
    margin: 12px 12px 0 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--card-brd);
    background: rgba(8, 9, 16, 0.85);
    color: var(--ink);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}
.nw-reader-close:hover { background: rgba(255, 255, 255, 0.1); }
.nw-reader-body {
    max-width: 100%;
    margin: 0 auto;
    padding: 8px clamp(28px, 5vw, 56px) 60px;
}

.nw-art-hero {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 14px;
    margin: 6px 0 20px;
    border: 1px solid var(--card-brd);
}
.nw-art-src {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--violet);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.nw-art-time { color: var(--ink-faint); font-size: 13px; font-weight: 500; }
.nw-art-title {
    font-family: "Newsreader", Georgia, serif;
    font-size: clamp(24px, 3.3vw, 33px);
    font-weight: 600;
    line-height: 1.22;
    letter-spacing: -0.01em;
    margin: 12px 0 18px;
}
.nw-art-text p {
    font-family: "Newsreader", Georgia, serif;
    font-size: 18px;
    line-height: 1.72;
    color: #d7dae6;
    margin: 0 0 18px;
}
.nw-art-text p:first-child { color: #eef0f7; }
.nw-art-foot {
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid var(--card-brd);
}
.nw-art-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--indigo), var(--violet));
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
}
.nw-art-link:hover { filter: brightness(1.08); }
.nw-art-note { color: var(--ink-faint); font-size: 12.5px; margin: 14px 0 0; line-height: 1.5; }

.nw-reader-loading, .nw-reader-error {
    padding: 60px 10px;
    text-align: center;
    color: var(--ink-dim);
}
.nw-reader-error { color: #fca5a5; }
.nw-spin {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 2.5px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--violet);
    border-radius: 50%;
    animation: nw-rot 0.7s linear infinite;
    vertical-align: -5px;
    margin-right: 10px;
}
@keyframes nw-rot { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
    .nw-reader-panel { width: 100%; }
}
@media (max-width: 640px) {
    .nw-reader-body { padding: 8px 20px 50px; }
    .nw-art-text p { font-size: 17px; }
    .top-nav .oc-link { padding: 6px 9px; font-size: 12px; }
    .nw-tab { padding: 9px 13px; font-size: 13px; }
}
