/* ==========================================================================
   Landing page — latest News & Events (.nsrl-latest)
   news-events.js fills the featured card + up to 4 side cards and adds .is-loaded.
   Featured = full-image card with the text over a soft gradient.
   Skeleton: public-ui.css. Category chips: News = teal, Event = gold.
   ========================================================================== */

.nsrl-latest {
  width: 100%;
  padding: calc(var(--nsrl-section-y) * 0.66) var(--nsrl-gutter) var(--nsrl-section-y);   /* top shortened: see #nsrl-overview */
  background-color: var(--nsrl-color-surface);
}

.nsrl-latest .nsrl-latest__inner {
  max-width: var(--nsrl-container-wide);
  margin: 0 auto;
}

/* ---------- Top row ---------- */
.nsrl-latest__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: clamp(32px, 4vw, 56px);
}
.nsrl-latest .nsrl-latest__see-more { flex-shrink: 0; }

/* ---------- Layout ---------- */
.nsrl-latest__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}

/* ---------- Featured (image card, text on top) ---------- */
html body .nsrl-latest a.nsrl-latest__featured:is(:link, :visited, :hover, :focus, :active) {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
  min-height: 520px;
  padding: clamp(24px, 3vw, 40px);
  overflow: hidden;
  isolation: isolate;
  color: #ffffff;
  text-decoration: none;
  background: var(--nsrl-color-green-900);
  border-radius: var(--nsrl-radius-xl);
  transition: box-shadow var(--nsrl-dur-base) ease, transform var(--nsrl-dur-base) var(--nsrl-ease-out);
}
html body .nsrl-latest.is-loaded a.nsrl-latest__featured:hover {
  box-shadow: var(--nsrl-shadow-lg);
  transform: translateY(-3px);
}
.nsrl-latest a.nsrl-latest__featured:focus-visible,
.nsrl-latest a.nsrl-latest__item:focus-visible {
  outline: 2px solid var(--nsrl-color-accent);
  outline-offset: 3px;
}

.nsrl-latest__featured-media {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: -1;
  overflow: hidden;
  background-color: var(--nsrl-color-green-800);
}
.nsrl-latest__featured-media::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(180deg, rgba(6, 40, 24, 0) 30%, rgba(6, 40, 24, 0.55) 60%, rgba(6, 40, 24, 0.92) 100%);
}
.nsrl-latest__featured-image {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  transition: transform 1s var(--nsrl-ease-out);
}
.nsrl-latest.is-loaded .nsrl-latest__featured:hover .nsrl-latest__featured-image { transform: scale(1.05); }

.nsrl-latest .nsrl-latest__featured .nsrl-latest__meta {
  order: 1;
  margin-bottom: 14px;
}
.nsrl-latest h3.nsrl-latest__featured-title {
  order: 2;
  max-width: 22ch;
  margin: 0;
  font-family: var(--nsrl-font-display);
  font-size: clamp(1.625rem, 1.2rem + 1.6vw, 2.5rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #ffffff;
  text-transform: none;
}
.nsrl-latest .nsrl-latest__featured .nsrl-latest__date { color: rgba(255, 255, 255, 0.78); }

/* Skeleton look for the featured card (light shimmer on the dark card) */
.nsrl-latest:not(.is-loaded) .nsrl-latest__featured-media::after { opacity: 0; }
.nsrl-latest:not(.is-loaded) .nsrl-latest__featured {
  --nsrl-skel-base: rgba(255, 255, 255, 0.1);
  --nsrl-skel-shine: rgba(255, 255, 255, 0.22);
}

/* ---------- Side list ---------- */
.nsrl-latest__list {
  --nsrl-latest-card-h: 112px;
  display: grid;
  grid-auto-rows: var(--nsrl-latest-card-h);
  align-content: start;
  gap: 12px;
  min-width: 0;
}
.nsrl-latest__list[data-count="4"] {
  grid-template-rows: repeat(4, minmax(var(--nsrl-latest-card-h), 1fr));
  grid-auto-rows: auto;
  align-content: stretch;
}

html body .nsrl-latest .nsrl-latest__item {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40%;
  gap: 0;
  padding: 0;
  color: var(--nsrl-color-heading);
  text-decoration: none;
  background-color: var(--nsrl-color-card);
  border: 1px solid rgba(11, 61, 36, 0.08);
  border-radius: var(--nsrl-radius-lg);
  overflow: hidden;
  transition: box-shadow var(--nsrl-dur-base) ease, transform var(--nsrl-dur-base) var(--nsrl-ease-out), border-color var(--nsrl-dur-base) ease;
}
.nsrl-latest.is-loaded .nsrl-latest__item { animation: nsrl-rise-in 0.5s var(--nsrl-ease-out) both; }
.nsrl-latest.is-loaded .nsrl-latest__item:nth-child(2) { animation-delay: 0.06s; }
.nsrl-latest.is-loaded .nsrl-latest__item:nth-child(3) { animation-delay: 0.12s; }
.nsrl-latest.is-loaded .nsrl-latest__item:nth-child(4) { animation-delay: 0.18s; }
html body .nsrl-latest.is-loaded a.nsrl-latest__item:hover {
  border-color: transparent;
  box-shadow: var(--nsrl-shadow-md);
  transform: translateY(-2px);
}

/* image first (left), text second — the JS outputs text then image, so order them here */
.nsrl-latest__item-image {
  -webkit-clip-path: polygon(22% 0, 100% 0, 100% 100%, 0 100%);
  clip-path: polygon(22% 0, 100% 0, 100% 100%, 0 100%);
  -webkit-transition: -webkit-transform 0.8s var(--nsrl-ease-out);
  transition: transform 0.8s var(--nsrl-ease-out);
  background-size: cover;
  background-position: center;
  background-color: var(--nsrl-color-sage);
}
.nsrl-latest a.nsrl-latest__item:hover .nsrl-latest__item-image { -webkit-transform: scale(1.05); transform: scale(1.05); }
.nsrl-latest__item-text {
  padding: 14px 8px 14px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}
.nsrl-latest h3.nsrl-latest__item-title {
  margin: 0;
  font-family: var(--nsrl-font-body);
  font-size: 0.975rem;
  font-weight: var(--nsrl-fw-bold);
  line-height: 1.35;
  color: var(--nsrl-color-heading);
  text-transform: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--nsrl-dur-fast) ease;
}
.nsrl-latest a.nsrl-latest__item:hover .nsrl-latest__item-title { color: var(--nsrl-color-accent-text); }
.nsrl-latest__item--skeleton .nsrl-latest__item-text { padding: 14px 16px 14px 20px; }

/* ---------- Category chip + date ---------- */
.nsrl-latest .nsrl-latest__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-family: var(--nsrl-font-body);
  font-size: var(--nsrl-fs-xs);
  line-height: 1.3;
}
.nsrl-latest .nsrl-latest__category {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--nsrl-radius-pill);
  font-size: 0.6875rem;
  font-weight: var(--nsrl-fw-bold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.nsrl-latest .nsrl-latest__category--news  { color: var(--nsrl-color-teal-800); background: var(--nsrl-color-teal-100); }
.nsrl-latest .nsrl-latest__category--event { color: var(--nsrl-color-gold-800); background: var(--nsrl-color-gold-100); }
.nsrl-latest .nsrl-latest__date {
  color: var(--nsrl-color-text-muted);
  font-weight: var(--nsrl-fw-medium);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .nsrl-latest__layout { grid-template-columns: 1fr; }
  html body .nsrl-latest a.nsrl-latest__featured:is(:link, :visited, :hover, :focus, :active) { min-height: 420px; }
  .nsrl-latest__list[data-count="4"] { grid-template-rows: none; grid-auto-rows: var(--nsrl-latest-card-h); align-content: start; }
}

@media (max-width: 600px) {
  .nsrl-latest .nsrl-latest__inner { display: flex; flex-direction: column; }
  .nsrl-latest__top { display: contents; }
  .nsrl-latest__top > :not(.nsrl-latest__see-more) { order: 1; margin-bottom: 28px; }
  .nsrl-latest__layout { order: 2; gap: 12px; }
  .nsrl-latest__top > .nsrl-latest__see-more { order: 3; align-self: stretch; justify-content: space-between; margin-top: 24px; }

  html body .nsrl-latest a.nsrl-latest__featured:is(:link, :visited, :hover, :focus, :active) { min-height: 360px; }
  .nsrl-latest__list { --nsrl-latest-card-h: 96px; }
  html body .nsrl-latest .nsrl-latest__item { grid-template-columns: minmax(0, 1fr) 36%; }
  .nsrl-latest__item-text { padding: 10px 6px 10px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .nsrl-latest__featured-image,
  .nsrl-latest .nsrl-latest__item,
  .nsrl-latest a.nsrl-latest__featured { transition: none; animation: none !important; }
  .nsrl-latest a.nsrl-latest__featured:hover,
  .nsrl-latest a.nsrl-latest__item:hover,
  .nsrl-latest .nsrl-latest__featured:hover .nsrl-latest__featured-image { transform: none; }
}
