/* ==========================================================================
   Interface upgrade — the components the redesigned pages introduced
   ==========================================================================

   Loaded LAST so it can settle anything the older sheets still assert. What is
   here is only what the new markup needs: the homepage lead, the four-story
   section block, the listing card, breadcrumbs, the pager and the article
   frame. Everything else — masthead, footer, ticker, update rail, bottom bar,
   push card — was already redesigned and is left alone.

   ── THE COLOUR RULE ───────────────────────────────────────────────────────
   Two hues doing two different jobs:

       red   (--sp-red)   URGENCY   breaking, live, the brand mark
       blue  (--sp-blue)  STRUCTURE sections, links, breadcrumbs, pager, nav

   The red is sampled from the NST Bihar wordmark. The blue is NOT in the logo
   — there is not one blue pixel in it — and is here on purpose; the reasoning
   is in the palette block in globals.css.

   A news page needs two signal channels. The reason news portals end up
   looking like alarm panels is that they run both through one red: when the
   section rule, the timestamp, the navigation and the BREAKING flag are all
   the same colour, none of them is a flag any more.

   ── THE TYPE RULE ─────────────────────────────────────────────────────────
   Devanagari sits taller than Latin at the same font-size and its matras need
   room above and below, so every line-height here is a step looser than the
   equivalent Latin value would be. Headlines never go below 1.35.
   ========================================================================== */

/* ------------------------------------------------------- shared: hairlines */

/*
 * The section rule that runs under every block heading. One definition,
 * because a heading rule that is 2px in one place and 3px in another is the
 * kind of drift nobody notices and everybody feels.
 */
.sp-sec-head,
.sp-cat-head {
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

.sp-sec-head::after,
.sp-cat-head::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 64px;
    height: 2px;
    background: var(--sp-blue);
}

/* ============================================================== HOME: LEAD */

.sp-lead {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 10px;
    background: #0b0f14;
    color: #fff;
    text-decoration: none;
    isolation: isolate;
}

.sp-lead-media {
    display: block;
    aspect-ratio: 16 / 9;
}

.sp-lead-img {
    width: 100%;
    height: 100%;
    /* `cover`, not the `fill` the old hero used. Filling a 16:9 box with a
       portrait crop stretched faces sideways; cropping loses edges, which on a
       news photograph is the lesser harm by a wide margin. */
    object-fit: cover;
    display: block;
}

/*
 * THE SCRIM.
 *
 * The previous hero laid a flat translucent panel over the picture. A fixed
 * opacity over an UNKNOWN photograph is legible over a dark frame and not over
 * a bright one — and a lead headline cannot be readable only some of the time.
 *
 * This is a gradient that is nearly opaque where the text sits and clears
 * completely by the middle of the image, so the contrast under the words does
 * not depend on what was photographed.
 */
.sp-lead-body {
    position: absolute;
    inset: auto 0 0 0;
    padding: clamp(14px, 2.2vw, 26px);
    background: linear-gradient(
        to top,
        rgba(6, 9, 13, 0.92) 0%,
        rgba(6, 9, 13, 0.78) 34%,
        rgba(6, 9, 13, 0.34) 68%,
        rgba(6, 9, 13, 0) 100%
    );
}

.sp-lead-kicker {
    display: inline-block;
    margin-bottom: 8px;
    padding: 3px 9px;
    border-radius: 3px;
    background: var(--sp-red);
    color: #fff;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.5;
}

.sp-lead-title {
    margin: 0;
    color: #fff;
    font-size: clamp(19px, 1.15rem + 1.1vw, 31px);
    font-weight: 700;
    line-height: 1.36;
    /* The shadow is for the tail of a long headline that runs past the densest
       part of the scrim, not for the first line. */
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.55);
}

.sp-lead-time {
    display: block;
    margin-top: 9px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 12.5px;
}

.sp-lead:hover .sp-lead-title,
.sp-lead:focus-visible .sp-lead-title {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* The rails beside the lead. */
.sp-home-rail,
.sp-home-ad {
    min-width: 0;
}

/* ========================================================= HOME: SECTIONS */

.sp-sec {
    min-width: 0;
}

.sp-sec-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 7px;
    margin-bottom: 12px;
}

.sp-sec-title {
    margin: 0;
    color: var(--sp-ink-head);
    font-size: 17px;
    font-weight: 700;
    line-height: 1.4;
}

.sp-sec-more {
    flex-shrink: 0;
    color: var(--sp-blue);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.sp-sec-more:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ---- the block's lead story ---- */

.sp-sec-lead {
    display: block;
    text-decoration: none;
    color: inherit;
}

.sp-sec-lead-media {
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-secondary);
}

.sp-sec-lead-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.sp-sec-lead:hover .sp-sec-lead-img {
    transform: scale(1.03);
}

.sp-sec-lead-title {
    margin: 9px 0 0;
    color: var(--sp-ink-head);
    font-size: 15.5px;
    font-weight: 600;
    line-height: 1.5;
}

.sp-sec-lead:hover .sp-sec-lead-title {
    color: var(--sp-blue);
}

.sp-sec-time {
    display: block;
    margin-top: 4px;
    color: var(--sp-ink-meta);
    font-size: 11.5px;
    line-height: 1.5;
}

/* ---- the three headline rows ---- */

/*
 * No thumbnails here, and that is the point. The picture column cost more
 * vertical room than the headline beside it, and at 110px a news photograph
 * conveys almost nothing — dropping it is what buys the fourth story in the
 * same height the old three-row block occupied.
 */
.sp-sec-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}

.sp-sec-list li + li {
    border-top: 1px solid var(--border-color);
}

.sp-sec-row {
    display: block;
    padding: 9px 0 9px 14px;
    position: relative;
    text-decoration: none;
    color: inherit;
}

/* A small blue tick instead of a bullet: it marks the row as a link without
   spending a whole glyph's width on a disc. */
.sp-sec-row::before {
    content: "";
    position: absolute;
    left: 0;
    top: 15px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--sp-blue);
    opacity: 0.55;
}

.sp-sec-row:hover::before {
    opacity: 1;
}

.sp-sec-row-title {
    display: block;
    color: var(--sp-ink-body);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.55;
}

.sp-sec-row:hover .sp-sec-row-title {
    color: var(--sp-blue);
}

/* ======================================================== LISTING: CARDS */

.sp-card {
    display: block;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.sp-card-media {
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-secondary);
}

.sp-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.sp-card:hover .sp-card-img {
    transform: scale(1.03);
}

.sp-card-title {
    margin: 9px 0 0;
    color: var(--sp-ink-head);
    /* 15px, not the 16px a card headline would take in Latin. Devanagari has a
       larger x-height equivalent, so it reads a size bigger than it is set. */
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
}

.sp-card:hover .sp-card-title {
    color: var(--sp-blue);
}

.sp-card-time {
    display: block;
    margin-top: 5px;
    color: var(--sp-ink-meta);
    font-size: 11.5px;
}

/* -------------------------------------------------------- listing: header */

.sp-cat-head {
    padding-bottom: 10px;
    margin-bottom: 18px;
}

.sp-cat-title {
    margin: 0;
    color: var(--sp-ink-head);
    font-size: clamp(21px, 1.1rem + 1vw, 28px);
    font-weight: 700;
    line-height: 1.4;
}

.sp-cat-page {
    color: var(--sp-ink-meta);
    font-weight: 500;
}

.sp-cat-desc {
    margin: 6px 0 0;
    max-width: 72ch;
    color: var(--sp-ink-lead);
    font-size: 14px;
    line-height: 1.7;
}

/* ============================================================ BREADCRUMBS */

/*
 * Blue, and the trail is a real list. Bootstrap's `.breadcrumb` drew its
 * separator with a ::before on every item, which screen readers announce as
 * content; this uses a separator that is marked aria-hidden by being generated
 * on the LIST, not the item.
 */
.sp-crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 12px 0;
    font-size: 12.5px;
    line-height: 1.6;
}

.sp-crumbs li + li::before {
    content: "›";
    margin-right: 6px;
    color: var(--sp-ink-meta);
}

.sp-crumbs a {
    color: var(--sp-blue);
    text-decoration: none;
}

.sp-crumbs a:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.sp-crumb-current {
    color: var(--sp-ink-meta);
}

/* ================================================================== PAGER */

.sp-pager {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin: 28px 0 8px;
}

.sp-pager a,
.sp-pager span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding-inline: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--sp-ink-body);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    background: var(--card-bg);
}

.sp-pager a:hover {
    border-color: var(--sp-blue);
    color: var(--sp-blue);
}

.sp-pager .is-current {
    background: var(--sp-blue);
    border-color: var(--sp-blue);
    color: #fff;
    font-weight: 700;
}

/* ================================================================ ARTICLE */

.sp-article-main {
    min-width: 0;
    margin-bottom: 20px;
}

.sp-article-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.sp-inline-ad {
    margin: 18px 0;
}

/* ============================================================ DARK MODE */

/*
 * Only what the new components need. The tokens carry the rest — that is why
 * the palette lives in globals.css as variables rather than as colours spread
 * through the sheets.
 */
.dark-mode .sp-lead {
    background: #05080b;
}

.dark-mode .sp-sec-lead-media,
.dark-mode .sp-card-media {
    background: #1a1f26;
}

.dark-mode .sp-pager a,
.dark-mode .sp-pager span {
    background: var(--card-bg);
}

/* ======================================================= REDUCED MOTION */

@media (prefers-reduced-motion: reduce) {
    .sp-sec-lead-img,
    .sp-card-img {
        transition: none;
    }

    .sp-sec-lead:hover .sp-sec-lead-img,
    .sp-card:hover .sp-card-img {
        transform: none;
    }
}

/* ============================================================ BRAND LOGO */

/*
 * TWO FILES, ONE SLOT.
 *
 * The wordmark is near-black on transparent — correct on the white masthead,
 * invisible against the dark-mode one. Both variants are in the markup and CSS
 * chooses; a JavaScript swap would show the wrong one until it ran, which on a
 * masthead is the first thing the reader sees.
 *
 * ── WHY THE SELECTORS CARRY `img` ─────────────────────────────────────────
 * The first version of this was `.sp-logo-dark { display: none }`, and BOTH
 * logos rendered. `header.css` already styles `.sp-head-logo img`, which is a
 * class plus an element — specificity 0-1-1 — and it sets `display`. A bare
 * `.sp-logo-dark` is 0-1-0 and loses, so the "hidden" one was never hidden.
 *
 * Qualifying these with `img` makes them 0-1-1 as well, and since this sheet
 * loads last the later rule wins. The dark-mode pair is 0-2-1 and wins
 * outright. Nothing here sets height or width: `header.css` owns the masthead
 * sizing and there is no reason for two files to argue about it.
 */
img.sp-logo-light {
    display: block;
}

img.sp-logo-dark {
    display: none;
}

.dark-mode img.sp-logo-light {
    display: none;
}

.dark-mode img.sp-logo-dark {
    display: block;
}
