/* =============================================================
   ARADEL NEWS CARDS & ARCHIVE
   File: /wp-content/mu-plugins/aradel-news.css

   IMPORTANT: Uses .ar-card--news only.
   Does NOT touch .ar-card--media (existing overlay cards).

   CHANGELOG v1.3
     - Card ease-in animation: @keyframes ar-card-in, applied via JS stagger.
     - .ar-news-filter-group-label: non-clickable dropdown section headers.
     - .ar-news-filter-reset: Reset Filters text button style.
   CHANGELOG v1.2
     - .ar-news-tabs/.ar-news-tab restyled to match .ar-segmented
       pattern from timeline: full-width track, #F0F3F4 bg,
       #01303A filled active pill, white text.
     - .ar-news-filter-btn/dropdown/option restyled to match
       Reg Announcements pill + dropdown pattern.
     - .ar-news-filter-submit restyled to match .ar-reg-page__submit.
     - .ar-news-loadmore-wrap/.ar-news-loadmore restyled to match
       .ar-reg-page__load-more-wrap pattern.
   ============================================================= */


/* ─────────────────────────────────────────────
   PILL COLOUR TOKENS
───────────────────────────────────────────── */

.ar-pill--ct-event,
.ar-pill--ct-news-article,
.ar-pill--ct-press-release,
.ar-pill--ct-publication,
.ar-pill--ct-thought-leadership,
.ar-pill--ct-video {
  --pill-bg: #F6D9DB;
  --pill-color: #1a1a1a;
}

.ar-pill--tag-community,
.ar-pill--tag-governance,
.ar-pill--tag-partnership,
.ar-pill--tag-thought-leadership {
  --pill-bg: #F6D9DB;
  --pill-color: #1a1a1a;
}

.ar-pill--tag-environment,
.ar-pill--tag-health-safety,
.ar-pill--tag-renewables,
.ar-pill--tag-sustainability {
  --pill-bg: #D6ECE3;
  --pill-color: #1a1a1a;
}

.ar-pill--tag-investors,
.ar-pill--tag-local-content,
.ar-pill--tag-operations {
  --pill-bg: #CDCDCD;
  --pill-color: #1a1a1a;
}

.ar-pill--tag-energy-access {
  --pill-bg: #efd5cb;
  --pill-color: #1a1a1a;
}


/* ─────────────────────────────────────────────
   NEWS CARD  .ar-card--news
───────────────────────────────────────────── */

.ar-card--news {
  --news-radius: 20px;
  --news-img-h: 280px;
  --news-body-h: 300px;
  --news-total-h: calc(var(--news-img-h) + var(--news-body-h));
  --news-easing: cubic-bezier(0.4, 0, 0.2, 1);
  --news-dur: 0.38s;

  position: relative;
  border-radius: var(--news-radius);
  overflow: hidden;
  background: #fff;
  cursor: pointer;
  /*
    CRITICAL: explicit height on the card itself.
    Nothing inside ever changes position type or
    affects document flow — zero layout shift.
  */
  height: var(--news-total-h);
  transition: transform var(--news-dur) var(--news-easing);
}

.ar-card--news:hover {
  transform: translateY(-3px);
}

/* ── Link wrapper — fills card ── */
.ar-card--news .ar-card__inner {
  display: block;
  position: absolute;
  inset: 0;
  text-decoration: none;
  color: inherit;
  outline: none;
}

.ar-card--news .ar-card__inner:focus-visible {
  outline: 2px solid var(--ads-brand-red, #C1000F);
  outline-offset: 2px;
  border-radius: var(--news-radius);
}

/* ── Image zone — always absolute, always full width ── */
.ar-card--news .ar-card__img-wrap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  /*
    At rest: only covers the image portion.
    On hover: extends to full card height.
    Both are CSS transitions on `height` — no position change.
  */
  height: var(--news-img-h);
  overflow: hidden;
  border-radius: var(--news-radius) var(--news-radius) 0 0;
  background: #e2ddd9;
  z-index: 0;
  transition: height var(--news-dur) var(--news-easing),
              border-radius var(--news-dur) var(--news-easing);
}

.ar-card--news:hover .ar-card__img-wrap {
  height: var(--news-total-h);
  border-radius: var(--news-radius);
}

.ar-card--news .ar-card__news-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.55s cubic-bezier(0.25, 1, 0.5, 1);
}

.ar-card--news:hover .ar-card__news-img {
  transform: scale(1.06);
}

/* Flat solid red overlay — no gradient banding.
   Single rgba value at a strong opacity gives the
   clean, premium Aradel red seen in the reference. */
.ar-card--news .ar-card__news-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(160, 8, 14, 0.82);
  opacity: 0;
  transition: opacity var(--news-dur) var(--news-easing);
  pointer-events: none;
}

.ar-card--news:hover .ar-card__news-overlay {
  opacity: 1;
}

/* ── Body — always absolute, always at bottom of card ── */
.ar-card--news .ar-card__body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--news-body-h);
  z-index: 2;
  padding: 24px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #F7F7F5;
  box-sizing: border-box;
  transition: background var(--news-dur) var(--news-easing),
              height var(--news-dur) var(--news-easing);
}

.ar-card--news:hover .ar-card__body {
  background: transparent;
  /* Grow enough to show full title (unclamped) + excerpt + date comfortably */
  height: calc(var(--news-body-h) + 120px);
}

/* Pill-to-title breathing room */
.ar-card--news .ar-card__pill {
  margin-bottom: 24px;
}

.ar-card--news .ar-card__title {
  margin-bottom: 10px;
}

/* ── Pill ── */
.ar-card--news .ar-card__pill {
  display: inline-flex;
  align-items: center;
  padding: 9px 24px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--pill-bg, #F6D9DB);
  color: var(--pill-color, #1a1a1a);
  align-self: flex-start;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Title — 16px per spec ── */
.ar-card--news .ar-card__title {
  font-family: var(--ads-font);
  font-size: 16px !important;
  font-weight: 600;
  line-height: 1.45;
  color: #1a1a1a;
  margin: 0;
  transition: color var(--news-dur) var(--news-easing);
  /* No line clamp — show full title */
}

/* Kill decorative underline from base card system */
.ar-card--news .ar-card__title::after {
  display: none !important;
}

/* ── Excerpt — zero-height at rest, slides in on hover ── */
.ar-card--news .ar-card__excerpt {
  font-size: 14px;
  line-height: 1.6;
  color: #666;
  margin: 0;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition:
    max-height 0.35s var(--news-easing),
    opacity 0.25s ease;
  pointer-events: none;
}

.ar-card--news:hover .ar-card__excerpt {
  max-height: 100px;
  opacity: 1;
}

/* ── Date ── */
.ar-card--news .ar-card__date {
  font-size: 13px;
  font-weight: 500;
  color: #999;
  letter-spacing: 0.04em;
  margin-top: auto;
  padding-top: 16px; /* spacing above date */
  transition: color var(--news-dur) var(--news-easing);
}

/* ── Hover text colours ── */
.ar-card--news:hover .ar-card__title {
  color: #fff !important;
}

.ar-card--news:hover .ar-card__date {
  color: rgba(255,255,255,0.68);
}

.ar-card--news:hover .ar-card__excerpt {
  color: rgba(255,255,255,0.82);
}


/* ─────────────────────────────────────────────
   CARD EASE-IN ANIMATION
   JS applies opacity:0 + translateY(24px) as
   inline styles, then clears them to trigger this.
   The @keyframes is a fallback for no-JS / SSR.
───────────────────────────────────────────── */

@keyframes ar-card-in {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/*
  On initial page load (no AJAX), cards start
  fully visible — JS adds the stagger inline.
  No class needed; animation is entirely JS-driven.
*/


/* ─────────────────────────────────────────────
   SLIDER SECTION
───────────────────────────────────────────── */

.ar-news-slider-section {
  max-width: 1440px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 112px;
  padding-right: 112px;
  padding-bottom: 96px;
  overflow: hidden;
  box-sizing: border-box;
}

@media (max-width: 1024px) {
  .ar-news-slider-section {
    padding-left: 64px;
    padding-right: 64px;
    padding-bottom: 72px;
  }
}

@media (max-width: 768px) {
  .ar-news-slider-section {
    padding-left: 24px;
    padding-right: 24px;
    padding-bottom: 48px;
  }
}

/* ── Header: title left, See all right ── */
.ar-news-slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 16px;
}

.ar-news-slider-heading {
  font-family: var(--ads-font);
  font-size: 32px;
  font-weight: 600;
  line-height: 1.25;
  color: #000;
  margin: 0;
  flex: 1;
}

@media (max-width: 1024px) {
  .ar-news-slider-heading {
    font-size: 28px;
  }
}

@media (max-width: 768px) {
  .ar-news-slider-heading {
    font-size: 24px;
  }
}

/* "See all News" — uses ar_action system, just ensure flex-shrink */
.ar-news-slider-header .ar-action {
  flex-shrink: 0;
}


/* ─────────────────────────────────────────────
   SPLIDE
───────────────────────────────────────────── */

.ar-news-splide .splide__arrows,
.ar-news-splide .splide__pagination {
  display: none;
}

.ar-news-splide,
.ar-news-splide .splide__track {
  overflow: visible;
}


/* ─────────────────────────────────────────────
   SEGMENTED PROGRESS TRACK
───────────────────────────────────────────── */

.ar-news-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 28px;
}

.ar-news-progress__seg {
  flex: 1;
  height: 3px;
  background: #ddd9d5;
  border-radius: 2px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
}

.ar-news-progress__seg:hover {
  background: #c0bbb6;
}

.ar-news-progress__fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(
    90deg,
    var(--ads-brand-red,  #C1000F),
    var(--ads-brand-blue, #01303A)
  );
  border-radius: 2px;
  transition: width 0.3s ease;
}

.ar-news-progress__seg.is-past .ar-news-progress__fill {
  width: 100%;
  transition: none;
}

.ar-news-progress__seg.is-active .ar-news-progress__fill {
  width: 100%;
}

.ar-news-progress__seg.is-active.is-autoplay .ar-news-progress__fill {
  width: 0%;
  transition: none;
  animation: ar-seg-fill var(--seg-duration, 5000ms) linear forwards;
}

@keyframes ar-seg-fill {
  from { width: 0%; }
  to   { width: 100%; }
}


/* ─────────────────────────────────────────────
   ARCHIVE SECTION
───────────────────────────────────────────── */

.ar-news-archive-section {
  max-width: 1440px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 112px;
  padding-right: 112px;
  padding-bottom: 96px;
  box-sizing: border-box;
}

@media (max-width: 1024px) {
  .ar-news-archive-section {
    padding-left: 64px;
    padding-right: 64px;
    padding-bottom: 72px;
  }
  .ar-card--news {
    --news-img-h: 240px;
    --news-body-h: 280px;
  }
}

@media (max-width: 768px) {
  .ar-news-archive-section {
    padding-left: 24px;
    padding-right: 24px;
    padding-bottom: 48px;
  }
  .ar-card--news {
    --news-img-h: 220px;
    --news-body-h: 300px;
  }
}

/* ── Grid ── */
.ar-news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 48px;
}

@media (max-width: 1024px) {
  .ar-news-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}

@media (max-width: 640px) {
  .ar-news-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

.ar-news-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 64px 24px;
  color: #888;
  font-size: 16px;
}

.ar-news-grid.is-loading {
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.2s ease;
}


/* ─────────────────────────────────────────────
   TAB BAR
   Matches .ar-segmented pattern from timeline:
   full-width track, #F0F3F4 bg, #01303A active pill.
───────────────────────────────────────────── */

.ar-news-tabs {
  position: relative;
  z-index: 0; /* contain active tab z-index:1 so it cannot bleed over the filter bar below */
  display: flex;
  align-items: center;
  background: #F0F3F4;
  border-radius: 20px;
  padding: 4px;
  gap: 0;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 36px;
}

.ar-news-tab {
  flex: 1;
  height: 56px;
  min-height: 56px;
  padding: 0 20px;
  border: none;
  background: transparent;
  border-radius: 16px;
  cursor: pointer;
  font-family: var(--ads-font);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ads-brand-blue, #01303A);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: background 200ms cubic-bezier(.2,.9,.2,1),
              color 200ms cubic-bezier(.2,.9,.2,1),
              box-shadow 200ms cubic-bezier(.2,.9,.2,1);
  white-space: nowrap;
  position: relative;
  z-index: 0;
}

.ar-news-tab:focus { outline: none; }
.ar-news-tab:focus-visible {
  outline: 2px solid var(--ads-brand-blue, #01303A);
  outline-offset: 2px;
}

.ar-news-tab.is-active,
.ar-news-tab[aria-selected="true"] {
  background: var(--ads-brand-blue, #01303A);
  color: #fff;
  box-shadow: 0 2px 8px rgba(1, 48, 58, 0.22);
  z-index: 1;
}

.ar-news-tab:hover:not(.is-active):not([aria-selected="true"]) {
  background: rgba(1, 48, 58, 0.08);
}

@media (max-width: 768px) {
  .ar-news-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-radius: 16px;
  }
  .ar-news-tabs::-webkit-scrollbar { display: none; }
  .ar-news-tab {
    padding: 0 18px;
    font-size: 12px;
    flex-shrink: 0;
  }
}


/* ─────────────────────────────────────────────
   FILTER BAR
   Matches .ar-reg-page__filters pattern.
───────────────────────────────────────────── */

.ar-news-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 12px;
  margin-bottom: 4px;
}

.ar-news-filters__label {
  font-family: 'Nunito Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  line-height: 32px;
  letter-spacing: -0.001px;
  color: #001014;
  white-space: nowrap;
  margin-right: 4px;
}

/* ── Filter group wrapper (for dropdown positioning) ── */
.ar-news-filter-group {
  position: relative;
}

/* ── Dropdown trigger button — pill style matching Reg Announcements ── */
.ar-news-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 41px;
  padding: 0 16px;
  border-radius: 20px;
  border: 1px solid #001014;
  background: transparent;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 15px;
  font-weight: 400;
  line-height: 24px;
  color: #001014;
  cursor: pointer;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
  -webkit-appearance: none;
  appearance: none;
}

.ar-news-filter-btn:focus-visible {
  border-color: #01303A;
  box-shadow: 0 0 0 3px rgba(1, 48, 58, 0.15);
}

.ar-news-filter-btn svg {
  flex-shrink: 0;
  transition: transform 0.2s ease;
  color: #001014;
}

.ar-news-filter-btn[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

/* ── Dropdown menu — matches Reg Announcements ── */
.ar-news-filter-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 200;
  min-width: 220px;
  background: #fff;
  border: 1px solid #001014;
  border-radius: 12px;
  padding: 8px 0;
  margin: 0;
  list-style: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  opacity: 0;
  /*
    visibility:hidden instead of pointer-events:none.
    A z-index:200 absolutely-positioned element using pointer-events:none
    can still create a stacking context that sits over the trigger button
    after syncContentTypeVisibility() reflows child elements — making the
    button unresponsive after tab switches. visibility:hidden removes the
    element from hit-testing cleanly without affecting sibling stacking.
    The visibility transition is delayed to match the opacity fade-out,
    then instant on open so the dropdown is immediately interactive.
  */
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
  display: block;
}

.ar-news-filter-dropdown.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0s;
}

/* ── Group label — non-clickable section header inside dropdown ── */
.ar-news-filter-group-label {
  display: block;
  padding: 8px 16px 4px;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #999;
  cursor: default;
  user-select: none;
  /* Separator above each group except the very first */
  margin-top: 4px;
}

.ar-news-filter-group-label:first-of-type {
  margin-top: 0;
}

/* Thin rule above each group label for visual separation */
.ar-news-filter-group-label::before {
  content: '';
  display: block;
  height: 1px;
  background: #e8e8e8;
  margin-bottom: 6px;
  margin-left: -16px;
  margin-right: -16px;
}

.ar-news-filter-option {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: none;
  text-align: left;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 15px;
  font-weight: 400;
  line-height: 24px;
  color: #001014;
  cursor: pointer;
  transition: background 0.12s ease;
  white-space: nowrap;
}

.ar-news-filter-option:hover {
  background: #e8e8e8;
}

.ar-news-filter-option.is-active {
  font-weight: 700;
  color: #005A4E;
}

/* ── Show Results button — matches .ar-reg-page__submit with ar-action__circle ── */
.ar-news-filter-submit {
  display: inline-flex;
  align-items: center;
  gap: 15px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 15px;
  font-weight: 400;
  line-height: 24px;
  color: #001014;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.ar-news-filter-submit:focus { outline: none; }
.ar-news-filter-submit:focus-visible {
  outline: 2px solid rgba(193, 0, 15, 0.35);
  outline-offset: 4px;
  border-radius: 999px;
}

/* Uses the exact .ar-action__circle structure from the ar_action shortcode */
.ar-news-filter-submit .ar-action__circle {
  border-color: #001014;
  color: #001014;
  width: 41px;
  height: 41px;
  flex-shrink: 0;
}

.ar-news-filter-submit:hover .ar-action__circle {
  background: #001014;
  border-color: #001014;
  color: #fff;
}

/* ── Reset Filters button — plain text link style ── */
.ar-news-filter-reset {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #888;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
  transition: color 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.ar-news-filter-reset:hover {
  color: var(--ads-brand-red, #C1000F);
}

.ar-news-filter-reset:focus { outline: none; }
.ar-news-filter-reset:focus-visible {
  outline: 2px solid rgba(193, 0, 15, 0.35);
  outline-offset: 4px;
  border-radius: 4px;
}

/* ── Keyword search input — matches .ar-reg-page__search-input ── */
.ar-news-filter-search-group {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.ar-news-filter-search {
  width: 100%;
  height: 41px;
  padding: 0 16px;
  border-radius: 20px;
  border: 1px solid #001014;
  background: transparent;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 15px;
  font-weight: 400;
  line-height: 24px;
  color: #001014;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.ar-news-filter-search::placeholder {
  color: rgba(0, 16, 20, 0.4);
}

.ar-news-filter-search:focus-visible {
  border-color: #01303A;
  box-shadow: 0 0 0 3px rgba(1, 48, 58, 0.15);
}

/* ── Mobile filters — R&P style dropdowns, hidden on desktop ── */
.ar-news-mobile-filters {
  display: none;
}

@media (max-width: 640px) {
  .ar-news-mobile-filters {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 16px;
    padding-bottom: 0;
  }

  /* Hide desktop filter bar and tabs on mobile */
  .ar-news-filters,
  .ar-news-tabs {
    display: none;
  }
}

.ar-news-mobile-select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.ar-news-mobile-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: #ffffff;
  border: 2px solid #01303A;
  border-radius: 20px;
  padding: 14px 48px 14px 20px;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #01303A;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease;
}

.ar-news-mobile-select:focus {
  border-color: #C1000F;
}

.ar-news-mobile-chevron {
  position: absolute;
  right: 16px;
  pointer-events: none;
  color: #01303A;
}


/* ─────────────────────────────────────────────
   LOAD MORE
   Centred row containing a real [ar_action] element.
   The ar_action shortcode (tone="sherpa") handles
   its own colours and WAAPI animation via aradel-actions.js.
   We only manage layout and loading state here.
───────────────────────────────────────────── */

.ar-news-loadmore-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 56px;
}

.ar-news-loadmore-wrap.is-hidden {
  display: none;
}

.ar-news-loadmore-wrap.is-loading {
  opacity: 0.5;
  pointer-events: none;
}

/* The ar_action element inside — font sizing to match label pattern */
.ar-news-loadmore__action {
  font-family: var(--ads-font, 'Nunito Sans', sans-serif);
  font-size: 16px;
  font-weight: 700;
}

@media (max-width: 768px) {
  .ar-news-loadmore-wrap {
    margin-top: 40px;
  }
}
