/* =========================================================
   NEWS — prefix: nwx (UI/UX polished)
   Theme-aware via html[data-theme="light"/"dark"]
   Drop-in replacement for your current nwx CSS
========================================================= */

:root {
  --nwx-radius: 18px;
  --nwx-radiusMedia: 16px;
  --nwx-blur: 14px;

  /* -------- THEME TOKENS -------- */
  --nwx-bg: #f6f8ff;
  --nwx-surface: rgba(255, 255, 255, .92);
  --nwx-border: rgba(17, 24, 39, .12);
  --nwx-text: #0b1220;
  --nwx-muted: rgba(11, 18, 32, .62);
  --nwx-muted2: rgba(11, 18, 32, .52);

  --nwx-shadow1: 0 20px 60px rgba(0, 0, 0, .08);
  --nwx-shadow2: 0 8px 24px rgba(0, 0, 0, .06);

  --nwx-accent: #2f62ff;
  --nwx-accentSoft: rgba(47, 98, 255, .14);
}

html[data-theme="dark"] {
  --nwx-bg: #050c19;
  --nwx-surface: rgba(10, 22, 44, .58);
  --nwx-border: rgba(255, 255, 255, .10);
  --nwx-text: #f4f7ff;
  --nwx-muted: rgba(210, 225, 255, .70);
  --nwx-muted2: rgba(210, 225, 255, .58);

  --nwx-shadow1: 0 26px 80px rgba(0, 0, 0, .42);
  --nwx-shadow2: 0 10px 28px rgba(0, 0, 0, .26);

  --nwx-accent: #60a5fa;
  --nwx-accentSoft: rgba(96, 165, 250, .16);
}

/* -------- SECTION -------- */
.nwx {
  padding: 190px 18px 120px;
  background:
    radial-gradient(1100px 520px at 50% -220px, var(--nwx-accentSoft), transparent 62%),
    linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0));
  color: var(--nwx-text);
}

html[data-theme="light"] .nwx {
  background:
    radial-gradient(1100px 520px at 50% -240px, var(--nwx-accentSoft), transparent 62%),
    linear-gradient(180deg, var(--nwx-bg), var(--nwx-bg));
}

html[data-theme="dark"] .nwx {
  background:
    radial-gradient(1100px 520px at 50% -240px, var(--nwx-accentSoft), transparent 62%),
    linear-gradient(180deg, var(--nwx-bg), var(--nwx-bg));
}

.nwx,
.nwx * {
  box-sizing: border-box;
}

.nwx__wrap {
  max-width: 1320px;
  margin: 0 auto;
}

/* -------- (Optional) header area if you keep it -------- */
.nwx__head {
  text-align: center;
  margin-bottom: 34px;
}

.nwx__title {
  margin: 0 0 10px;
  font-weight: 950;
  letter-spacing: -0.03em;
  font-size: clamp(30px, 3.2vw, 48px);
  color: var(--nwx-text);
}

.nwx__subtitle {
  margin: 0 auto;
  max-width: 860px;
  color: var(--nwx-muted);
  font-size: 16px;
  line-height: 1.75;
}

/* -------- GRID -------- */
.nwx__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 34px;
}

/* -------- CARD (premium) -------- */
.nwx__card {
  position: relative;
  overflow: hidden;
  border-radius: var(--nwx-radius);

  background: var(--nwx-surface);
  border: 1px solid var(--nwx-border);
  box-shadow: var(--nwx-shadow1), var(--nwx-shadow2);

  backdrop-filter: blur(var(--nwx-blur));
  -webkit-backdrop-filter: blur(var(--nwx-blur));

  transform: translateY(0);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

/* subtle inner glow */
.nwx__card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;

  background:
    radial-gradient(520px 260px at 18% 10%, var(--nwx-accentSoft), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, 0) 42%);
  opacity: .9;
}

/* hover (desktop only) */
@media (hover:hover) {
  .nwx__card:hover {
    transform: translateY(-6px);
    border-color: color-mix(in srgb, var(--nwx-accent) 35%, var(--nwx-border));
    box-shadow:
      0 28px 84px rgba(0, 0, 0, .12),
      0 10px 30px rgba(0, 0, 0, .08);
  }
}

/* -------- MEDIA -------- */
.nwx__media {
  position: relative;
  display: block;
  height: 260px;
  overflow: hidden;
  border-radius: var(--nwx-radiusMedia);
  margin: 14px 14px 0;
  background: rgba(0, 0, 0, .04);
}

html[data-theme="dark"] .nwx__media {
  background: rgba(255, 255, 255, .04);
}

.nwx__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.02);
  transition: transform .35s ease, filter .35s ease;
}

@media (hover:hover) {
  .nwx__card:hover .nwx__img {
    transform: scale(1.06);
    filter: saturate(1.06) contrast(1.02);
  }
}

/* soft vignette for readability */
.nwx__media::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0) 54%, rgba(0, 0, 0, .22) 100%);
  opacity: .55;
}

/* -------- BODY -------- */
.nwx__body {
  position: relative;
  padding: 18px 22px 18px;
  margin-top: 10px;
}

/* title */
.nwx__h3 {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 950;
  line-height: 1.22;
  letter-spacing: -0.01em;
}

.nwx__link {
  color: var(--nwx-text);
  text-decoration: none;
}

.nwx__link:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/* excerpt */
.nwx__text {
  margin: 0 0 16px;
  color: var(--nwx-muted2);
  font-size: 15px;
  line-height: 1.7;

  display: -webkit-box;
  -webkit-box-orient: vertical;

  line-clamp: 3;
  -webkit-line-clamp: 3;

  overflow: hidden;
}

/* -------- FOOTER / SHARE -------- */
.nwx__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;

  padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--nwx-border) 80%, transparent);
}

.nwx__share {
  color: var(--nwx-muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .01em;
}

/* icons */
.nwx__icons {
  display: inline-flex;
  gap: 10px;
}

.nwx__icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 10px;

  color: var(--nwx-text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 900;

  border: 1px solid color-mix(in srgb, var(--nwx-border) 85%, transparent);
  background: color-mix(in srgb, var(--nwx-surface) 82%, transparent);

  transition: transform .18s ease, border-color .18s ease, background .18s ease, color .18s ease;
}

@media (hover:hover) {
  .nwx__icon:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--nwx-accent) 42%, var(--nwx-border));
    background: color-mix(in srgb, var(--nwx-accentSoft) 60%, var(--nwx-surface));
  }
}

/* -------- RESPONSIVE -------- */
@media (max-width: 1080px) {
  .nwx__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 28px;
  }
}

@media (max-width: 980px) {
  .nwx {
    padding: 140px 16px 96px;
  }

  .nwx__media {
    height: 240px;
    margin: 12px 12px 0;
  }

  .nwx__body {
    padding: 16px 16px 16px;
  }

  .nwx__h3 {
    font-size: 20px;
  }
}

@media (max-width: 768px) {
  .nwx__grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

@media (max-width: 520px) {
  .nwx {
    padding: 120px 14px 84px;
  }

  .nwx__media {
    height: 220px;
  }

  .nwx__icon {
    width: 26px;
    height: 26px;
    border-radius: 9px;
  }
}

/* optional: if you want to hide scrollbars in case icons overflow */
.nwx__icons {
  scrollbar-width: none;
}

.nwx__icons::-webkit-scrollbar {
  display: none;
}

/* ===== NEWS LINK HOVER EFFECT ===== */
.nwx__link {
  position: relative;
  text-decoration: none !important;
  color: var(--nwx-text);
  transition: color .35s ease;
}

.nwx__link:hover {
  text-decoration: none !important;
}

@media (hover:hover) {
  .nwx__link {
    background: linear-gradient(90deg,
        var(--nwx-text),
        var(--nwx-accent),
        #60a5fa,
        var(--nwx-accent),
        var(--nwx-text));
    background-size: 250% auto;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: var(--nwx-text);
  }

  .nwx__link:hover {
    -webkit-text-fill-color: transparent;
    animation: nwxGradientShift 1.4s ease forwards;
  }

  @keyframes nwxGradientShift {
    0% {
      background-position: 0% center;
    }

    100% {
      background-position: 100% center;
    }
  }
}