/*
 * News Portal — base layer shared by every theme.
 * Reset, accessibility helpers and the shared components (listen player,
 * video facade, highlights, share bar, tags, pagination). Themes restyle
 * these through the custom properties below and their own theme.css.
 */

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

:root {
  --np-bg: #fff;
  --np-fg: #111;
  --np-muted: #666;
  --np-line: #e5e5e5;
  --np-accent: #d00;
  --np-radius: 6px;
  --np-indic: system-ui;
}

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }

body { margin: 0; overflow-x: hidden; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
img, video, iframe { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { overflow-wrap: anywhere; }

/* Indic scripts need taller lines and no tracking to render correctly. */
:lang(hi), :lang(mr), :lang(bn), :lang(te), :lang(ta), :lang(gu), :lang(kn), :lang(ml),
:lang(pa), :lang(or), :lang(as), :lang(mai), :lang(ne), :lang(kok), :lang(sa), :lang(ur) {
  letter-spacing: 0 !important;
  line-height: 1.7;
}
:lang(hi) h1, :lang(hi) h2, :lang(hi) h3, :lang(mr) h1, :lang(bn) h1, :lang(ta) h1, :lang(te) h1,
:lang(gu) h1, :lang(kn) h1, :lang(ml) h1, :lang(pa) h1, :lang(ur) h1 { line-height: 1.4; }
[dir="rtl"] .np-prose { text-align: right; }

.np-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.np-skip { position: absolute; left: -999px; top: 0; z-index: 1000; padding: .75rem 1rem; background: #000; color: #fff; }
.np-skip:focus { left: 1rem; top: 1rem; }
:focus-visible { outline: 3px solid var(--np-accent); outline-offset: 2px; }

/* Image placeholders when a story has no picture yet. */
.np-img { width: 100%; object-fit: cover; background: var(--np-line); }
.np-img--empty {
  display: grid; place-items: center; aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--np-cat, #64748b), color-mix(in srgb, var(--np-cat, #64748b) 55%, #000));
  color: rgba(255,255,255,.85); font-size: 2.5rem; font-weight: 700;
}

/* ---- Article prose ------------------------------------------------ */
.np-prose { overflow-wrap: break-word; }

.np-prose > * { margin-block: 0; }
.np-prose > * + * { margin-top: 1.1em; }
.np-prose h2 { margin: 1.8em 0 .5em; line-height: 1.25; }
.np-prose h3 { margin: 1.5em 0 .4em; line-height: 1.3; }
.np-prose ul, .np-prose ol { padding-inline-start: 1.3em; margin: 0; }
.np-prose li + li { margin-top: .4em; }
.np-prose blockquote { margin: 1.5em 0; padding: .2em 0 .2em 1.1em; border-inline-start: 4px solid var(--np-accent); font-size: 1.1em; font-style: italic; }
.np-prose img { border-radius: var(--np-radius); margin: 1.5em auto; }
.np-prose a { color: var(--np-accent); text-underline-offset: 3px; }
.np-prose table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.np-prose th, .np-prose td { border: 1px solid var(--np-line); padding: .5em; text-align: start; }

.np-highlights { margin: 0 0 1.75rem; padding: 1rem 1.25rem; border-radius: var(--np-radius); background: color-mix(in srgb, var(--np-accent) 7%, var(--np-bg)); border-inline-start: 4px solid var(--np-accent); }
.np-highlights__title { margin: 0 0 .5rem; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--np-accent); }
.np-highlights ul { margin: 0; padding-inline-start: 1.1rem; }
.np-highlights li { margin: .35rem 0; line-height: 1.5; }

.np-credit { margin: 2rem 0 0; font-size: .875rem; color: var(--np-muted); font-style: italic; }

.np-tags { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 1.5rem 0 0; }
.np-tags a { display: inline-block; padding: .35rem .75rem; border: 1px solid var(--np-line); border-radius: 999px; font-size: .85rem; text-decoration: none; color: var(--np-muted); }
.np-tags a:hover { border-color: var(--np-accent); color: var(--np-accent); }

/* ---- Listen player ------------------------------------------------ */
.np-listen { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: 1rem 0; padding: .45rem .5rem .45rem .45rem; border: 1px solid var(--np-line); border-radius: 999px; position: relative; overflow: hidden; max-width: 100%; }
.np-listen[hidden] { display: none; }
.np-listen__btn { display: inline-flex; align-items: center; gap: .45rem; border: 0; cursor: pointer; background: var(--np-accent); color: #fff; padding: .45rem .95rem; border-radius: 999px; font-weight: 600; font-size: .9rem; }
.np-listen__pause, .np-listen.is-playing .np-listen__play { display: none; }
.np-listen.is-playing .np-listen__pause { display: inline; }
.np-listen__meta { font-size: .85rem; color: var(--np-muted); }
.np-listen__rate, .np-listen__stop { border: 1px solid var(--np-line); background: transparent; border-radius: 999px; padding: .25rem .6rem; font-size: .8rem; cursor: pointer; display: inline-flex; align-items: center; }
.np-listen__progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; }
.np-listen__progress span { display: block; height: 100%; width: 0; background: var(--np-accent); transition: width .3s; }
.np-listen--file { border-radius: var(--np-radius); }
.np-listen--file audio { flex: 1 1 240px; height: 40px; }
.np-listen__label { display: inline-flex; gap: .4rem; align-items: center; font-weight: 600; font-size: .9rem; }
.np-listen__notice { font-size: .85rem; color: var(--np-muted); }

/* ---- Video -------------------------------------------------------- */
.np-video { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--np-radius); overflow: hidden; margin: 0 0 1.5rem; max-width: 100%; }
.np-video img, .np-video iframe, .np-video video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; }
.np-video__play { position: absolute; inset: 0; margin: auto; width: 76px; height: 54px; background: none; border: 0; cursor: pointer; filter: drop-shadow(0 4px 12px rgba(0,0,0,.4)); transition: transform .15s; }
.np-video__play:hover { transform: scale(1.08); }
.np-play-badge { position: absolute; inset-inline-start: .6rem; bottom: .6rem; display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; }
.np-play-badge svg { width: 1rem; height: 1rem; }

/* ---- Share -------------------------------------------------------- */
.np-share { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.np-share__btn { display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 1px solid var(--np-line); background: transparent; color: var(--np-fg); cursor: pointer; text-decoration: none; transition: background .15s, color .15s; }
.np-share__btn[hidden] { display: none; }
.np-share__btn:hover { background: var(--np-fg); color: var(--np-bg); }
.np-share__wa:hover { background: #25d366; color: #fff; border-color: #25d366; }

/* ---- Pagination, language, ads, toast ------------------------------ */
.np-pagination { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 2.5rem 0 1rem; }
.np-pagination__link { padding: .65rem 1.1rem; border: 1px solid var(--np-line); border-radius: var(--np-radius); text-decoration: none; font-weight: 600; }
.np-pagination__link:hover { border-color: var(--np-accent); color: var(--np-accent); }
.np-pagination__info { color: var(--np-muted); font-size: .9rem; }

.np-lang { display: inline-flex; align-items: center; gap: .3rem; }
.np-lang select { border: 0; background: transparent; font-size: .875rem; cursor: pointer; padding: .25rem; max-width: 9rem; }
.np-lang select option { color: #111; background: #fff; }

/* Ads. Positions wait at zero size until ads.js fills them (hidden
   elements are never "near the screen", so they must stay in the flow). */
.np-ad { box-sizing: border-box; width: 100%; max-width: 1200px; margin: 0 auto; padding-inline: 1rem; text-align: center; overflow: hidden; }
.np-ad.is-filled { margin-block: 1.5rem; }
.np-ad:empty { display: none; }
.np-ad__label { display: block; margin-bottom: .35rem; font: 600 .65rem/1 system-ui, sans-serif; letter-spacing: .12em; text-transform: uppercase; color: var(--np-muted); }
.np-ad__body { display: flex; justify-content: center; align-items: center; }
.np-ad__body > * { max-width: 100%; }
.np-ad__body img { display: block; max-width: 100%; height: auto; margin-inline: auto; }
.np-ad__body ins.adsbygoogle { width: 100%; }
.np-ad--sidebar, .np-ad--in_article, .np-ad--in_feed, .np-ad--article_top, .np-ad--article_end, .np-ad--listing_top { padding-inline: 0; }
.np-ad--in_article.is-filled { margin-block: 2rem; padding-block: .75rem; border-block: 1px solid var(--np-line); }
.np-ad--in_feed { grid-column: 1 / -1; }
.np-ad--sidebar.is-filled { margin-block: 0 1.5rem; }

.np-ad--sticky_footer { position: fixed; inset-inline: 0; bottom: 0; z-index: 70; max-width: none; margin: 0; padding: .35rem 2.5rem .35rem; background: var(--np-bg); box-shadow: 0 -4px 18px rgba(0,0,0,.14); }
.np-ad--sticky_footer.is-filled { margin: 0; }
.np-ad--sticky_footer .np-ad__label { display: none; }
.np-ad--sticky_footer .np-ad__body { max-height: 100px; }
.np-ad__close { position: absolute; top: .25rem; inset-inline-end: .35rem; width: 1.9rem; height: 1.9rem; border: 0; border-radius: 50%; background: rgba(0,0,0,.08); color: inherit; font-size: 1.2rem; line-height: 1; cursor: pointer; }
body.has-np-sticky-ad { padding-bottom: 110px; }
.has-bottom-nav .np-ad--sticky_footer { bottom: calc(60px + env(safe-area-inset-bottom)); }
body.has-bottom-nav.has-np-sticky-ad { padding-bottom: calc(170px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { .has-bottom-nav .np-ad--sticky_footer { bottom: 0; } body.has-bottom-nav.has-np-sticky-ad { padding-bottom: 110px; } }

/* Staff preview (?ad_preview=1): every position outlined. */
.np-ad--preview { display: flex; flex-direction: column; gap: .25rem; margin-block: 1rem; padding: 1rem; min-height: 90px; justify-content: center; border: 2px dashed #f59e0b; border-radius: 8px; background: repeating-linear-gradient(45deg, rgba(245,158,11,.07) 0 12px, rgba(245,158,11,.14) 12px 24px); color: #92400e; font: 500 .8rem/1.4 system-ui, sans-serif; }
.np-ad--preview strong { font-size: .9rem; }
.np-ad--preview.np-ad--sticky_footer { position: static; box-shadow: none; }

.np-toast { position: fixed; left: 50%; bottom: 5.5rem; transform: translate(-50%, 1rem); opacity: 0; background: #111; color: #fff; padding: .6rem 1rem; border-radius: 999px; font-size: .9rem; transition: all .2s; z-index: 999; pointer-events: none; }
.np-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* Horizontal scrollers used by several themes on mobile. */
.np-scroller { display: flex; gap: 1rem; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.np-scroller::-webkit-scrollbar { display: none; }
.np-scroller > * { scroll-snap-align: start; flex: 0 0 auto; }

/* Breaking-news ticker */
.np-ticker { display: flex; align-items: stretch; overflow: hidden; }
.np-ticker__label { flex: none; display: flex; align-items: center; gap: .4rem; font-weight: 700; text-transform: uppercase; font-size: .75rem; letter-spacing: .06em; padding: 0 .85rem; }
.np-ticker__track { flex: 1; overflow: hidden; position: relative; mask-image: linear-gradient(90deg, transparent, #000 2rem, #000 calc(100% - 2rem), transparent); }
.np-ticker__list { display: flex; gap: 2.5rem; list-style: none; margin: 0; padding: .55rem 0; white-space: nowrap; width: max-content; animation: np-ticker 45s linear infinite; }
.np-ticker__track:hover .np-ticker__list, .np-ticker__track:focus-within .np-ticker__list { animation-play-state: paused; }
.np-ticker__list a { text-decoration: none; font-size: .9rem; }
.np-ticker__list a:hover { text-decoration: underline; }
@keyframes np-ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }
[dir="rtl"] .np-ticker__list { animation-direction: reverse; }
.np-live-dot { width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; animation: np-pulse 1.5s ease-in-out infinite; }
@keyframes np-pulse { 50% { opacity: .3; } }

/* Placeholder initials sit behind headlines on overlay-style covers; hide them there. */
.p-card--overlay .np-img--empty span, .e-cover .np-img--empty span,
.m-tile--xl .np-img--empty span, .m-tile--tall .np-img--empty span { display: none; }
