/*
 * Khabar Sangraha — editorial refinements, loaded after the Tailwind build
 * (public/build). Hand-written because the server has no Node to rebuild Tailwind:
 * rules here are unlayered, so they win over Tailwind's layered classes.
 * Never add letter-spacing to text that may be Nepali: it breaks the headline bar
 * (shirorekha) joining the letters.
 */

:root {
    --ks-red: #c8102e;
    --ks-red-dark: #9c0c24;
    --ks-ink: #121418;
    --ks-ink-2: #2a2d34;
    --ks-muted: #5f6368;
    --ks-paper: #f8f6f1;
    --ks-rule: #e7e2d8;
    --ks-rule-soft: #efebe3;
    --ks-sand: #f3efe6;
    --ks-radius: 14px;
    --ks-shadow-sm: 0 1px 2px rgba(18, 20, 24, .04), 0 1px 3px rgba(18, 20, 24, .04);
    --ks-shadow-md: 0 2px 4px rgba(18, 20, 24, .04), 0 8px 24px rgba(18, 20, 24, .07);
}

body {
    background: var(--ks-paper);
    color: var(--ks-ink);
    text-rendering: optimizeLegibility;
}
::selection { background: rgba(200, 16, 46, .14); }
a, button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--ks-red); outline-offset: 2px; border-radius: 4px; }

.ks-wrap { max-width: 80rem; margin: 0 auto; padding: 0 1rem; }

/* ---------- App bar (top) ---------- */
.ks-appbar { background: var(--ks-ink); color: rgba(255, 255, 255, .82); font-size: 13px; }
.ks-appbar .ks-wrap { display: flex; align-items: center; gap: .75rem; min-height: 38px; }
.ks-appbar-text { line-height: 1.3; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ks-appbar-actions { margin-left: auto; display: flex; gap: .5rem; flex-shrink: 0; }
.ks-pill {
    display: inline-flex; align-items: center; gap: .35rem;
    border-radius: 999px; padding: .2rem .8rem; font-weight: 600; font-size: 12.5px;
    transition: background .15s, color .15s, border-color .15s;
}
.ks-pill-red { background: var(--ks-red); color: #fff; }
.ks-pill-red:hover { background: var(--ks-red-dark); }
.ks-pill-ghost { border: 1px solid rgba(255, 255, 255, .22); color: #fff; }
.ks-pill-ghost:hover { background: rgba(255, 255, 255, .08); }
.ks-pill-muted { background: rgba(255, 255, 255, .1); color: #fff; }

/* ---------- Utility row ---------- */
.ks-util { background: #fff; border-bottom: 1px solid var(--ks-rule-soft); color: var(--ks-muted); font-size: 13px; }
.ks-util .ks-wrap { display: flex; align-items: center; gap: 1.1rem; height: 38px; }
.ks-util a:hover { color: var(--ks-red); }
.ks-date { display: inline-flex; align-items: center; gap: .45rem; color: var(--ks-ink-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ks-date::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ks-red); flex-shrink: 0; }
.ks-util-right { margin-left: auto; display: flex; align-items: center; gap: .6rem; flex-shrink: 0; }
.ks-seg { display: inline-flex; background: var(--ks-sand); border-radius: 999px; padding: 2px; }
.ks-seg a { padding: .1rem .65rem; border-radius: 999px; color: var(--ks-muted); font-weight: 500; }
.ks-seg a.is-on { background: #fff; color: var(--ks-ink); font-weight: 600; box-shadow: var(--ks-shadow-sm); }
.ks-switch { border: 1px solid var(--ks-rule); border-radius: 999px; padding: .1rem .75rem; font-weight: 600; color: var(--ks-ink); }
.ks-switch:hover { border-color: var(--ks-red); }

/* ---------- Masthead ---------- */
.ks-masthead { background: #fff; }
.ks-masthead .ks-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; padding-top: 1.4rem; padding-bottom: 1.4rem; }
.ks-brand { display: flex; align-items: center; gap: .85rem; }
.ks-brand img { height: 3.4rem; width: auto; }
.ks-brand-name { font-family: var(--font-serif); font-weight: 700; font-size: 2.35rem; line-height: 1; color: var(--ks-ink); }
.ks-brand-tag { margin-top: .4rem; font-size: 13.5px; color: var(--ks-muted); display: flex; align-items: center; gap: .5rem; }
.ks-brand-tag::before { content: ''; width: 18px; height: 2px; background: var(--ks-red); border-radius: 2px; }
.ks-search { position: relative; margin-left: auto; width: 100%; max-width: 22rem; }
.ks-search input {
    width: 100%; border: 1px solid transparent; background: var(--ks-sand); border-radius: 999px;
    padding: .6rem 2.75rem .6rem 1.1rem; font-size: 15px; transition: background .15s, border-color .15s, box-shadow .15s;
}
.ks-search input:focus { outline: none; background: #fff; border-color: var(--ks-rule); box-shadow: 0 0 0 4px rgba(200, 16, 46, .08); }
.ks-search button { position: absolute; right: .8rem; top: 50%; transform: translateY(-50%); color: var(--ks-muted); }
.ks-search button:hover { color: var(--ks-red); }
@media (max-width: 639px) {
    .ks-masthead .ks-wrap { padding-top: 1rem; padding-bottom: 1rem; }
    .ks-brand img { height: 2.75rem; }
    .ks-brand-name { font-size: 1.9rem; }
    .ks-search { max-width: none; margin-left: 0; }
}

/* ---------- Navigation (sticky) ---------- */
.ks-nav {
    position: sticky; top: 0; z-index: 40;
    background: rgba(255, 255, 255, .92);
    -webkit-backdrop-filter: saturate(1.6) blur(12px); backdrop-filter: saturate(1.6) blur(12px);
    border-top: 1px solid var(--ks-rule-soft); border-bottom: 1px solid var(--ks-rule);
    box-shadow: 0 6px 18px -14px rgba(18, 20, 24, .35);
}
.ks-nav-scroll { display: flex; align-items: center; gap: .15rem; overflow-x: auto; scrollbar-width: none; }
.ks-nav-scroll::-webkit-scrollbar { display: none; }
.ks-nav a {
    position: relative; white-space: nowrap; padding: .85rem .8rem; font-weight: 600; font-size: 15.5px; color: var(--ks-ink-2);
    transition: color .15s;
}
.ks-nav a::after {
    content: ''; position: absolute; left: .8rem; right: .8rem; bottom: 0; height: 3px; border-radius: 3px 3px 0 0;
    background: var(--ks-red); transform: scaleX(0); transition: transform .2s ease;
}
.ks-nav a:hover { color: var(--ks-red); }
.ks-nav a.is-on { color: var(--ks-red); }
.ks-nav a.is-on::after, .ks-nav a:hover::after { transform: scaleX(1); }
.ks-nav a.ks-nav-sub { font-weight: 500; font-size: 14px; color: var(--ks-muted); padding-left: .6rem; padding-right: .6rem; }
.ks-nav a.ks-nav-sub::after { left: .6rem; right: .6rem; }
.ks-nav-sep { width: 1px; height: 18px; background: var(--ks-rule); margin: 0 .5rem; flex-shrink: 0; }
@media (max-width: 1023px) {
    .ks-nav-scroll { -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
}

/* ---------- Section titles: title, a hairline, then the "see all" link ---------- */
.section-title { font-size: 1.3rem; margin-bottom: 1.1rem; gap: .65rem; }
.section-title::before { width: 4px; height: 1.35rem; border-radius: 2px; }
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--ks-rule); order: 1; min-width: 1.5rem; }
.section-title a { order: 2; margin-left: 0; font-size: 13.5px; white-space: nowrap; }

/* ---------- Panels: the white boxes used across the site ---------- */
.bg-white.border-rule.rounded-lg,
.bg-white.border-rule.rounded-xl {
    border-radius: var(--ks-radius);
    border-color: var(--ks-rule-soft);
    box-shadow: var(--ks-shadow-sm);
}

/* ---------- News cards ---------- */
.headline { color: var(--ks-ink); }
article.group > a.bg-sand { border-radius: 12px; box-shadow: inset 0 0 0 1px rgba(18, 20, 24, .04); }
article.group > a.bg-sand img { transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
article.group:hover > a.bg-sand img { transform: scale(1.035); }
article.group h3 a { background-image: linear-gradient(currentColor, currentColor); background-size: 0 1px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size .3s; }
article.group h3.text-2xl { font-size: clamp(1.55rem, 1.1rem + 1.6vw, 2.25rem); line-height: 1.22; }
.meta { color: var(--ks-muted); }

.badge { border-radius: 999px; padding: .1rem .55rem; font-size: 11.5px; text-transform: none; }

/* ---------- Buttons, inputs, chips ---------- */
.btn { border-radius: 10px; }
.btn-primary { box-shadow: 0 1px 2px rgba(156, 12, 36, .25), inset 0 1px 0 rgba(255, 255, 255, .12); }
.input { border-radius: 10px; border-color: var(--ks-rule); }
.input:focus { border-color: var(--ks-red); box-shadow: 0 0 0 4px rgba(200, 16, 46, .08); --tw-ring-color: transparent; }
.chip { border-color: var(--ks-rule); }

/* Service tiles in the sidebar */
.ks-tiles a { border-color: var(--ks-rule-soft) !important; background: #fcfbf8; border-radius: 12px !important; }
.ks-tiles a:hover { background: #fff !important; border-color: rgba(200, 16, 46, .35) !important; box-shadow: var(--ks-shadow-md); transform: translateY(-1px); }

/* ---------- Footer ---------- */
.ks-footer { margin-top: 3.5rem; background: var(--ks-ink); color: rgba(255, 255, 255, .7); font-size: 14px; }
.ks-footer-top { border-top: 3px solid var(--ks-red); }
.ks-footer-grid { display: grid; gap: 2rem; padding-top: 3rem; padding-bottom: 2.5rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .ks-footer-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .ks-footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; } }
.ks-footer-brand { font-family: var(--font-serif); font-weight: 700; font-size: 1.75rem; color: #fff; line-height: 1.1; }
.ks-footer h3 { font-family: var(--font-sans); font-size: 13px; font-weight: 700; color: #fff; margin-bottom: .9rem; text-transform: uppercase; }
.ks-footer ul { display: grid; gap: .5rem; }
.ks-footer a:hover { color: #fff; }
.ks-footer-note { color: rgba(255, 255, 255, .5); font-size: 13px; line-height: 1.65; margin-top: .9rem; }
.ks-social { display: inline-flex; align-items: center; gap: .45rem; margin-top: 1.1rem; padding: .4rem .9rem; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .18); color: #fff; font-weight: 600; font-size: 13px; }
.ks-social:hover { background: rgba(255, 255, 255, .08); }
.ks-footer-bottom { border-top: 1px solid rgba(255, 255, 255, .08); }
.ks-footer-bottom .ks-wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; padding-top: 1.1rem; padding-bottom: 1.1rem; font-size: 12.5px; color: rgba(255, 255, 255, .45); }

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

/* Small helpers the prebuilt Tailwind file lacks */
@media (max-width: 639px) { .ks-date { display: none; } }
.ks-xl-only { display: none; flex-shrink: 0; }
@media (min-width: 1280px) { .ks-xl-only { display: inline; } }
/* Sticky sidebar boxes sit below the sticky menu */
@media (min-width: 1024px) { .lg\:sticky.lg\:top-4 { top: 4.5rem; } }

/* ---------- Article page ---------- */
.ks-story { min-width: 0; }
.ks-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; font-size: 13px; color: var(--ks-muted); margin-bottom: 1.1rem; }
.ks-crumbs a:hover { color: var(--ks-red); }
.ks-crumbs a + a::before { content: '›'; margin-right: .35rem; color: #b9b3a8; }
.ks-kicker {
    display: inline-block; background: rgba(200, 16, 46, .08); color: var(--ks-red);
    border-radius: 999px; padding: .15rem .75rem; font-size: 13px; font-weight: 700; margin-bottom: .85rem;
}
.ks-kicker:hover { background: rgba(200, 16, 46, .14); }
.ks-title {
    font-family: var(--font-serif); font-weight: 700; color: var(--ks-ink);
    font-size: clamp(1.85rem, 1.25rem + 2.2vw, 2.85rem); line-height: 1.25; max-width: 46rem;
}
.ks-byline {
    display: flex; align-items: center; gap: .8rem; margin-top: 1.25rem; padding: .9rem 0;
    border-top: 1px solid var(--ks-rule); border-bottom: 1px solid var(--ks-rule);
}
.ks-byline-name { font-weight: 700; color: var(--ks-ink); line-height: 1.3; }
.ks-avatar {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 2.4rem; height: 2.4rem; border-radius: 50%;
    background: linear-gradient(135deg, #e0283f, var(--ks-red-dark)); color: #fff;
    font-weight: 700; font-size: 1.05rem; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12);
}
.ks-avatar-lg { width: 3rem; height: 3rem; font-size: 1.3rem; }
.ks-figure { margin-top: 1.5rem; }
.ks-figure img { width: 100%; max-height: 520px; object-fit: cover; border-radius: 16px; background: var(--ks-sand); box-shadow: var(--ks-shadow-md); }
.ks-figure figcaption { margin-top: .55rem; font-size: 12.5px; color: var(--ks-muted); }
.ks-standfirst {
    margin-top: 1.5rem; font-size: 1.2rem; line-height: 1.85; color: var(--ks-ink-2);
    padding-left: 1.1rem; border-left: 3px solid var(--ks-red);
}
.ks-readcard {
    margin-top: 1.75rem; display: flex; flex-wrap: wrap; align-items: center; gap: .9rem 1rem;
    padding: 1.1rem 1.25rem; border-radius: var(--ks-radius);
    background: linear-gradient(135deg, #fff 0%, #fbf7f0 100%);
    border: 1px solid var(--ks-rule-soft); box-shadow: var(--ks-shadow-md);
}
.ks-readcard-label { font-weight: 700; color: var(--ks-ink); line-height: 1.35; }
.ks-readcard-host { font-size: 13px; color: var(--ks-muted); }
.ks-readcard-btn { padding: .75rem 1.25rem; font-size: 15px; }
@media (max-width: 639px) { .ks-readcard-btn { width: 100%; } }
.ks-sharebar { margin-top: 1.25rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--ks-rule); }

.ks-coverage > li + li { border-top: 1px solid var(--ks-rule-soft); }
.ks-coverage a { display: flex; align-items: center; gap: .85rem; padding: .85rem .25rem; border-radius: 10px; transition: background .15s; }
.ks-coverage a:hover { background: #fbf8f2; }
.ks-coverage .ks-avatar { width: 2.1rem; height: 2.1rem; font-size: .95rem; background: var(--ks-ink-2); }
.ks-coverage-title { display: block; font-weight: 600; line-height: 1.4; color: var(--ks-ink); }
.ks-coverage a:hover .ks-coverage-title { color: var(--ks-red); }
.ks-coverage-arrow { width: 1.1rem; height: 1.1rem; flex-shrink: 0; color: #b9b3a8; transition: color .15s, transform .15s; }
.ks-coverage a:hover .ks-coverage-arrow { color: var(--ks-red); transform: translate(2px, -2px); }

/* ---------- Sidebar ---------- */
.ks-mini { display: flex; gap: .85rem; padding: .8rem 0; align-items: flex-start; }
.ks-mini + .ks-mini { border-top: 1px solid var(--ks-rule-soft); }
.ks-mini-img { width: 5.5rem; aspect-ratio: 4 / 3; flex-shrink: 0; border-radius: 10px; overflow: hidden; background: var(--ks-sand); }
.ks-mini-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.ks-mini:hover .ks-mini-img img { transform: scale(1.06); }
.ks-mini-title { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-weight: 600; line-height: 1.4; color: var(--ks-ink); margin-bottom: .2rem; }
.ks-mini:hover .ks-mini-title { color: var(--ks-red); }

/* Panels inside sidebars: tighter headings, softer dividers */
aside .bg-white.border-rule .section-title { font-size: 1.12rem; margin-bottom: .85rem; }
aside .divide-rule > :not(:last-child) { border-color: var(--ks-rule-soft); }
aside .divide-rule > li > a.group { border-radius: 10px; padding-left: .35rem; padding-right: .35rem; margin: 0 -.35rem; transition: background .15s; }
aside .divide-rule > li > a.group:hover { background: #fbf8f2; }
