/* newsplus: shared components for all news sites (scoped under .np-*) */
:root {
  --np-accent: #c62828;
  --np-text: #1f2328;
  --np-muted: #6b7280;
  --np-border: #e5e7eb;
  --np-surface: #ffffff;
  --np-soft: #f5f6f8;
  --np-radius: 10px;
  --np-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

/* Images from {% np_img %} carry width/height attributes (no layout shift while loading); when the
   theme shrinks the width to fit the screen, the height must follow or the photo gets stretched. */
:where(img.np-img) { height: auto; max-width: 100%; }

.np-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.np-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.np-muted { color: var(--np-muted); font-size: 14px; }

/* Pages rendered by newsplus inside each site's layout */
.np-page { padding: 32px 0 48px; font-family: var(--np-font); color: var(--np-text); }
.np-container { max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.np-card { background: var(--np-surface); border: 1px solid var(--np-border); border-radius: var(--np-radius); padding: 24px; }
.np-h1 { font-size: 28px; line-height: 1.25; margin: 0 0 12px; font-weight: 700; }
.np-h2 { font-size: 20px; margin: 32px 0 16px; font-weight: 700; }
.np-btn { display: inline-block; background: var(--np-accent); color: #fff !important; border: 0; border-radius: 8px; padding: 10px 18px; font-weight: 600; text-decoration: none !important; cursor: pointer; }
.np-btn:hover { filter: brightness(1.08); }
.np-message { max-width: 560px; margin: 0 auto; text-align: center; }
.np-message.is-error .np-h1 { color: var(--np-accent); }
.np-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.np-tile { display: flex; flex-direction: column; gap: 6px; color: inherit !important; text-decoration: none !important; }
.np-tile__img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 8px; background: var(--np-soft); }
.np-tile__title { font-weight: 600; line-height: 1.35; }
.np-tile:hover .np-tile__title { color: var(--np-accent); }
.np-pager { display: flex; gap: 16px; justify-content: center; align-items: center; margin-top: 28px; }
.np-pager a { color: var(--np-accent); font-weight: 600; }

/* Authors */
.np-avatar { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; background: var(--np-accent); color: #fff; font-weight: 700; font-size: 26px; }
.np-avatar--lg { width: 120px; height: 120px; font-size: 48px; }
.np-author-box { display: flex; gap: 16px; align-items: flex-start; margin: 28px 0; padding: 18px; border: 1px solid var(--np-border); border-radius: var(--np-radius); background: var(--np-soft); font-family: var(--np-font); }
.np-author-box__photo img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; display: block; }
.np-author-box__name { font-weight: 700; font-size: 17px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.np-author-box__name a { color: var(--np-text) !important; text-decoration: none; }
.np-author-box__role { color: var(--np-muted); font-size: 14px; font-weight: 500; }
.np-author-box__bio { margin: 6px 0 8px; color: var(--np-text); font-size: 15px; line-height: 1.55; }
.np-social { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.np-social a { display: inline-block; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--np-border); font-size: 13px; color: var(--np-text) !important; text-decoration: none !important; background: var(--np-surface); }
.np-social a:hover { border-color: var(--np-accent); color: var(--np-accent) !important; }
.np-author-hero { display: flex; gap: 24px; align-items: center; margin-bottom: 8px; }
.np-author-hero__photo img { width: 160px; height: 160px; border-radius: 50%; object-fit: cover; }
.np-author-hero__bio { line-height: 1.6; }
.np-author-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.np-author-card img { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; }
.np-author-card__name { font-weight: 700; color: var(--np-text) !important; }
.np-byline { font-weight: 600; }
@media (max-width: 600px) { .np-author-hero { flex-direction: column; text-align: center; } .np-author-hero .np-social { justify-content: center; } }

/* Share */
.np-share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 18px 0; font-family: var(--np-font); }
.np-share__label { font-weight: 600; font-size: 14px; color: var(--np-muted); margin-right: 2px; }
.np-share__btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 8px; border: 0; color: #fff !important; font-size: 14px; font-weight: 600; text-decoration: none !important; cursor: pointer; line-height: 1; }
.np-share__btn svg { width: 18px; height: 18px; fill: currentColor; }
.np-share__btn:hover { filter: brightness(1.1); }
.np-fb { background: #1877f2; } .np-x { background: #111; } .np-msg { background: #0084ff; } .np-tg { background: #229ed9; }
.np-li { background: #0a66c2; } .np-copy { background: #4b5563; } .np-native { background: var(--np-accent); }
.np-msg { display: none; }
@media (hover: none) and (pointer: coarse) { .np-msg { display: inline-flex; } }
@media (max-width: 520px) { .np-share__btn span { display: none; } .np-share__btn { width: 40px; justify-content: center; padding: 0; } }

/* Rating */
.np-rating { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 18px 0; font-family: var(--np-font); }
.np-rating__label { font-weight: 600; font-size: 14px; color: var(--np-muted); }
.np-rating__stars { display: inline-flex; }
.np-star { background: none; border: 0; padding: 0 2px; font-size: 26px; line-height: 1; color: #d1d5db; cursor: pointer; transition: transform .1s; }
.np-star.is-on, .np-rating__stars:hover .np-star { color: #f5a623; }
.np-rating__stars .np-star:hover ~ .np-star { color: #d1d5db; }
.np-star:hover { transform: scale(1.15); }
.np-rating.is-done .np-star { cursor: default; }
.np-rating__summary { font-size: 14px; color: var(--np-muted); }

/* Newsletter */
.np-newsletter { font-family: var(--np-font); margin: 12px 0; }
.np-newsletter__title { font-weight: 700; font-size: 17px; margin-bottom: 4px; }
.np-newsletter__text { font-size: 14px; opacity: .8; margin: 0 0 10px; }
.np-newsletter__row { display: flex; gap: 8px; max-width: 460px; }
.np-newsletter input[type=email] { flex: 1; min-width: 0; height: 42px; padding: 0 12px; border-radius: 8px; border: 1px solid #cbd0d6; font-size: 15px; color: #1f2328; background: #fff; }
.np-newsletter button { height: 42px; padding: 0 16px; border-radius: 8px; border: 0; background: var(--np-accent); color: #fff; font-weight: 600; cursor: pointer; white-space: nowrap; }
.np-newsletter__msg { font-size: 14px; margin-top: 8px; min-height: 1em; }
.np-newsletter__msg.is-ok { color: #2e7d32; } .np-newsletter__msg.is-error { color: #e53935; }
.np-newsletter--compact .np-newsletter__title { font-size: 15px; }

/* Theme toggle */
.np-theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(127,127,127,.35); background: transparent; color: inherit; cursor: pointer; padding: 0; vertical-align: middle; }
.np-theme-toggle svg { width: 18px; height: 18px; fill: currentColor; }
.np-theme-toggle .np-icon-sun { display: none; }
html[data-theme=dark] .np-theme-toggle .np-icon-sun { display: block; }
html[data-theme=dark] .np-theme-toggle .np-icon-moon { display: none; }
.np-theme-float { position: fixed; right: 16px; bottom: 76px; z-index: 9999; background: var(--np-surface); box-shadow: 0 2px 10px rgba(0,0,0,.18); }

/* Weather & currency strip */
.np-wr { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-family: var(--np-font); font-size: 13px; }
.np-wr__weather img { vertical-align: middle; }
.np-wr__rate b { font-weight: 600; }
.np-up { color: #2e7d32; font-style: normal; font-size: 10px; } .np-down { color: #e53935; font-style: normal; font-size: 10px; }

/* Banners */
.np-banners { margin: 16px auto; text-align: center; }
.np-banner img, .np-banner video { max-width: 100%; height: auto; display: inline-block; border-radius: 4px; }
.np-banner.is-hidden { display: none; }
.np-ratio { position: relative; padding-top: 56.25%; }
.np-ratio iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Credit */
.np-credit a { color: inherit !important; text-decoration: none; }
.np-credit a:hover { text-decoration: underline; }

/* Article body images never overflow. CKEditor stores a fixed height in the style attribute when an
   editor resizes a picture; once the width shrinks to fit the screen that height would stretch it. */
.np-article-body img { max-width: 100% !important; height: auto !important; }
.np-article-body iframe { max-width: 100%; }

/* ---------- Dark mode ----------
   The eight sites use different legacy themes, so dark mode inverts the page colours and
   turns photos/videos back to normal. Site-specific fixes live in each site's own CSS. */
html[data-theme=dark] { color-scheme: dark; background: #fff; filter: invert(.9) hue-rotate(180deg); }
html[data-theme=dark] img,
html[data-theme=dark] picture,
html[data-theme=dark] video,
html[data-theme=dark] iframe,
html[data-theme=dark] embed,
html[data-theme=dark] object,
html[data-theme=dark] svg image,
html[data-theme=dark] [style*="background-image"],
html[data-theme=dark] .np-keep-colors { filter: invert(1) hue-rotate(180deg); }
html[data-theme=dark] .np-keep-colors img,
html[data-theme=dark] .np-keep-colors video,
html[data-theme=dark] .np-keep-colors iframe { filter: none; }
@media print { html[data-theme=dark] { filter: none; } html[data-theme=dark] img { filter: none; } }

/* Polls */
.np-poll { font-family: var(--np-font); border: 1px solid var(--np-border); border-radius: var(--np-radius); padding: 16px; margin: 16px 0; background: var(--np-surface); color: var(--np-text); }
.np-poll__img { width: 100%; height: auto; border-radius: 8px; margin-bottom: 10px; display: block; }
.np-poll__q { font-weight: 700; font-size: 16px; margin-bottom: 12px; line-height: 1.35; }
.np-poll__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.np-poll__answer { position: relative; display: flex; justify-content: space-between; gap: 8px; width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--np-border); border-radius: 8px; background: var(--np-soft); color: var(--np-text); cursor: pointer; overflow: hidden; font-size: 14px; }
.np-poll__answer:hover { border-color: var(--np-accent); }
.np-poll__bar { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(198,40,40,.14); transition: width .5s ease; }
.np-poll__text, .np-poll__pct { position: relative; }
.np-poll__pct { font-weight: 700; display: none; }
.np-poll.is-voted .np-poll__pct { display: inline; }
.np-poll.is-voted .np-poll__answer { cursor: default; }
.np-poll__answer.is-mine { border-color: var(--np-accent); }
.np-poll__foot { margin-top: 10px; font-size: 13px; color: var(--np-muted); }

/* Gallery (photos attached to an article) */
.np-gallery { margin: 24px 0; font-family: var(--np-font); }
.np-gallery__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.np-gallery__title { font-weight: 700; font-size: 17px; }
.np-gallery__count { color: var(--np-muted); font-size: 14px; }
.np-gallery__stage { position: relative; }
.np-gallery__track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; border-radius: var(--np-radius); background: #111; scrollbar-width: none; outline: none; }
.np-gallery__track::-webkit-scrollbar { display: none; }
.np-gallery__slide { flex: 0 0 100%; margin: 0; scroll-snap-align: center; display: flex; align-items: center; justify-content: center; aspect-ratio: 3 / 2; }
.np-gallery__slide a { display: block; width: 100%; height: 100%; cursor: zoom-in; }
.np-gallery__img { width: 100%; height: 100%; object-fit: contain; display: block; }
.np-gallery__slide { position: relative; }
.np-gallery__caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 14px 10px; color: #fff; font-size: 14px; line-height: 1.4; background: linear-gradient(transparent, rgba(0,0,0,.75)); pointer-events: none; }
.np-gallery__nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 30px; line-height: 40px; cursor: pointer; }
.np-gallery__nav:hover { background: rgba(0,0,0,.8); }
.np-gallery__nav--prev { left: 10px; } .np-gallery__nav--next { right: 10px; }
.np-gallery__nav[disabled] { opacity: .25; cursor: default; }
.np-gallery__thumbs { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: thin; }
.np-gallery__thumb { flex: 0 0 auto; padding: 0; border: 2px solid transparent; border-radius: 6px; background: none; cursor: pointer; opacity: .65; }
.np-gallery__thumb img { display: block; width: 90px; height: 60px; object-fit: cover; border-radius: 4px; }
.np-gallery__thumb.is-active { border-color: var(--np-accent); opacity: 1; }
@media (max-width: 600px) { .np-gallery__nav { width: 36px; height: 36px; font-size: 24px; line-height: 32px; } }

/* Images inside article text open in the viewer */
.np-article-body img.np-zoomable { cursor: zoom-in; }

/* Full-screen viewer */
.np-lb { position: fixed; inset: 0; z-index: 100000; background: rgba(8,8,10,.96); display: flex; flex-direction: column; font-family: var(--np-font); color: #fff; touch-action: pan-y; }
.np-lb[hidden] { display: none; }
.np-lb__bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; font-size: 14px; }
.np-lb__btn { background: rgba(255,255,255,.12); border: 0; color: #fff; width: 42px; height: 42px; border-radius: 50%; font-size: 24px; line-height: 1; cursor: pointer; }
.np-lb__btn:hover { background: rgba(255,255,255,.25); }
.np-lb__stage { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.np-lb__img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; transition: transform .25s ease, opacity .2s; }
.np-lb__nav { position: absolute; top: 50%; transform: translateY(-50%); }
.np-lb__nav--prev { left: 12px; } .np-lb__nav--next { right: 12px; }
.np-lb__caption { padding: 10px 16px 16px; text-align: center; font-size: 14px; color: #ddd; min-height: 1.4em; }
html[data-theme=dark] .np-lb, html[data-theme=dark] .np-gallery__track { filter: invert(1) hue-rotate(180deg); }
html[data-theme=dark] .np-lb img, html[data-theme=dark] .np-gallery__track img { filter: none; }

/* Reader login for comments */
.np-login { clear: both; font-family: var(--np-font); border: 1px solid var(--np-border); border-radius: var(--np-radius); padding: 20px; margin: 16px 0; background: var(--np-soft); color: var(--np-text); }
.np-login__title { font-weight: 700; font-size: 17px; margin-bottom: 6px; }
.np-login__text { font-size: 14px; color: var(--np-muted); margin: 0 0 14px; line-height: 1.55; }
.np-login__buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.np-login__btn { display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 16px; border-radius: 8px; font-weight: 600; font-size: 15px; text-decoration: none !important; border: 1px solid var(--np-border); }
.np-login__btn svg { width: 20px; height: 20px; }
.np-login__btn--google-oauth2 { background: #fff; color: #1f2328 !important; }
.np-login__btn--facebook { background: #1877f2; color: #fff !important; border-color: #1877f2; }
.np-login__btn--github { background: #24292f; color: #fff !important; border-color: #24292f; }
.np-login__btn:hover { filter: brightness(1.06); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.np-reader { clear: both; font-family: var(--np-font); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0; padding: 10px 12px; border: 1px solid var(--np-border); border-radius: var(--np-radius); background: var(--np-soft); color: var(--np-text); font-size: 14px; }
.np-reader__avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.np-reader__avatar--letter { display: inline-flex; align-items: center; justify-content: center; background: var(--np-accent); color: #fff; font-weight: 700; }
.np-reader__who { flex: 1; min-width: 0; }
.np-reader__logout { margin: 0; }
.np-reader__logout button { background: none; border: 1px solid var(--np-border); border-radius: 6px; padding: 4px 10px; color: var(--np-text); cursor: pointer; font-size: 13px; }
.np-comment-authed [data-np-guest-only] { display: none !important; }
.np-comment-badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 999px; background: var(--np-soft); color: var(--np-muted); border: 1px solid var(--np-border); margin-left: 6px; vertical-align: middle; }
html[data-theme=dark] .np-login__btn svg { filter: none; }

/* Policy pages (/privacy, /terms, /advertise, /data-deletion) */
.np-legal__wrap { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; align-items: start; }
.np-legal__nav { position: sticky; top: 16px; display: grid; gap: 4px; font-size: 14px; }
.np-legal__nav a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--np-text) !important; text-decoration: none !important; }
.np-legal__nav a:hover { background: var(--np-soft); }
.np-legal__nav a[aria-current=page] { background: var(--np-soft); color: var(--np-accent) !important; font-weight: 600; }
.np-legal__doc { max-width: 760px; font-size: 16px; line-height: 1.7; color: var(--np-text); }
.np-legal__doc h2 { font-size: 20px; font-weight: 700; margin: 32px 0 10px; line-height: 1.3; scroll-margin-top: 16px; }
.np-legal__doc h3 { font-size: 16px; font-weight: 700; margin: 0 0 6px; }
.np-legal__doc p, .np-legal__doc li { margin: 0 0 10px; }
.np-legal__doc ul, .np-legal__doc ol { padding-left: 22px; margin: 0 0 12px; }
.np-legal__doc a { color: var(--np-accent); }
.np-legal__head { border-bottom: 1px solid var(--np-border); padding-bottom: 12px; margin-bottom: 8px; }
.np-legal__lead { font-size: 18px; color: var(--np-muted); }
.np-legal__toc { background: var(--np-soft); border-radius: var(--np-radius); padding: 14px 18px; margin: 16px 0 8px; font-size: 15px; }
.np-legal__toc ol { margin: 6px 0 0; columns: 2; column-gap: 24px; }
.np-legal__table { overflow-x: auto; margin: 0 0 14px; border: 1px solid var(--np-border); border-radius: 8px; }
.np-legal__table table { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 520px; }
.np-legal__table th, .np-legal__table td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--np-border); }
.np-legal__table th { background: var(--np-soft); font-size: 13px; }
.np-legal__table tr:last-child td { border-bottom: 0; }
.np-legal__num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.np-legal__cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.np-legal__cards > div { border: 1px solid var(--np-border); border-radius: var(--np-radius); padding: 14px 16px; }
.np-legal__cards p { font-size: 14.5px; margin: 0; }
.np-legal__steps li { margin-bottom: 8px; }
.np-legal__contact { margin-top: 36px; padding-top: 8px; border-top: 1px solid var(--np-border); }
.np-legal__notice { padding: 12px 16px; border-radius: 8px; margin: 12px 0; font-weight: 600; }
.np-legal__notice.is-ok { background: #e7f4ec; color: #1e6b3b; }
.np-legal__notice.is-error { background: #fbeceb; color: #a1281f; }
.np-legal__delete { display: grid; gap: 10px; padding: 14px 16px; border: 1px solid var(--np-border); border-radius: var(--np-radius); background: var(--np-soft); }
.np-legal__delete label { display: flex; gap: 8px; align-items: flex-start; font-size: 15px; }
.np-legal__delete .np-btn { justify-self: start; background: #b42318; }
.np-legal-links a { color: inherit !important; }
@media (max-width: 860px) {
  .np-legal__wrap { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .np-legal__nav { position: static; display: flex; flex-wrap: wrap; }
  .np-legal__toc ol { columns: 1; }
}
