/*================================================
Modernisation layer
=================================================
Loaded after style.css / dark.css / responsive.css. It only adds to the existing design language
(same colours, fonts, layout); nothing in the original stylesheets was rewritten, so it can be
removed by deleting this file's enqueue in inc/assets.php.
=================================================*/

:root {
  --ae-red: #d72924;
  --ae-radius: 6px;
  --ae-shadow: 0 2px 14px rgba(0, 0, 0, 0.07);
}

.theme-dark {
  color-scheme: dark;
}

/* ---- Base ---------------------------------------------------------------- */
html {
  scroll-behavior: smooth;
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Images carry width/height attributes (prevents layout shift). Keep their natural ratio when
   CSS scales them; :where() has zero specificity, so every existing sizing rule still wins. */
:where(img[width][height]) {
  height: auto;
}

h1, h2, h3 {
  text-wrap: balance;
}

/* ---- Accessibility -------------------------------------------------------- */
.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link.screen-reader-text:focus {
  position: fixed !important;
  top: 8px;
  left: 8px;
  z-index: 100000;
  width: auto;
  height: auto;
  margin: 0;
  padding: 12px 20px;
  clip: auto;
  background: #ffffff;
  color: #232323;
  font-weight: 600;
  border-radius: var(--ae-radius);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.3);
}

#main-content:focus {
  outline: 0;
}

:focus-visible {
  outline: 2px solid var(--ae-red);
  outline-offset: 2px;
}

.theme-dark :focus-visible {
  outline-color: #ffffff;
}

.switch input:focus-visible + .slider {
  outline: 2px solid var(--ae-red);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ---- Header ---------------------------------------------------------------- */
.top-header .logo img {
  height: auto;
  max-width: 100%;
}

/* Keep the logo link's baseline exactly as before (overflow:hidden would change it) */
.top-header .logo a.sk-media {
  overflow: visible;
}

.breadcrumb-nav {
  display: block;
}

.breadcrumb {
  flex-wrap: wrap;
  overflow-wrap: anywhere;
}

/* ---- Cards ----------------------------------------------------------------- */
.single-featured-news .slider-thumb,
.single-popular-news .news-image,
.single-category-news .category-news-image,
.international-news-list .news-media > a {
  border-radius: var(--ae-radius);
}

.single-featured-news.slider_news .slider-thumb img,
.single-popular-news .news-image img,
.single-category-news .category-news-image img {
  width: 100%;
  object-fit: cover;
}

.single-category-news {
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(128, 128, 128, 0.18);
}

.single-category-news:last-of-type {
  border-bottom: 0;
}

.news-content h3,
.category-news-content h3,
.news-media .content h3 {
  overflow-wrap: anywhere;
}

/* Placeholder box for posts without a featured image: keep the same footprint as a real image */
.slider-thumb.is-empty { height: 270px; }
.single-popular-news .news-image.is-empty { height: 180px; }
.category-news-image.is-empty { height: 246px; }
.article-img.is-empty { display: none; }

.article-img .thumbnail-caption {
  margin-top: 8px;
}

/* ---- Home page ------------------------------------------------------------- */
/* The three-column "special" grid had no small-screen behaviour */
@media (max-width: 991px) {
  .special-news {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575px) {
  .special-news {
    grid-template-columns: minmax(0, 1fr);
  }
}

.brand-logos {
  align-items: center;
}

.brand-logos .single-brand img {
  width: auto;
  height: 60px;
}

@media (max-width: 575px) {
  .brand-logos {
    gap: 16px;
    justify-content: center;
    padding: 14px;
  }
}

/* ---- Pop-up advert --------------------------------------------------------- */
body.advt-popup-open {
  overflow: hidden;
}

.advt-body .advt-media {
  height: 100%;
  text-align: center;
}

.advt-body .advt-media img {
  max-width: 100%;
  height: 100%;
  object-fit: contain;
}

button#closeBtn {
  z-index: 5; /* stay above the image wrapper (.sk-media is positioned) */
  width: 40px;
  height: 40px;
  padding: 0;
  line-height: 38px;
  font-family: inherit;
}

/* ---- Back to top (now a <button>) ------------------------------------------- */
button.go-top {
  border: 0;
  padding: 0;
  border-radius: 50%;
  font-family: inherit;
}

/* ---- Article content ---------------------------------------------------------- */
.news-details .article-content img,
.page-body img {
  max-width: 100%;
  height: auto;
}

.news-details .article-content table,
.page-body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.news-details .article-content iframe,
.news-details .article-content video {
  max-width: 100%;
}

article.news-details {
  min-width: 0;
}

.post-controls-buttons {
  gap: 20px;
}

/* ---- Pagination fallback (only used if WP-PageNavi is inactive) -------------------- */
.pagination-area .nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.pagination-area .page-numbers {
  text-align: center;
}

.pagination-area .screen-reader-text {
  display: none;
}

/* ---- Misc -------------------------------------------------------------------- */
.no-results {
  padding: 20px 0;
  font-size: 17px;
}

.top-advt-box,
.stay-connected-ads,
.popular-section-ads {
  max-width: 100%;
}
