/* ==========================================================================
   NsN — Light modern tech homepage
   ========================================================================== */

.nsn-home #primary,
.nsn-home .content-area,
.nsn-home .newsmatic-container,
.nsn-home .site-main {
  max-width: 100%;
}

body.nsn-home.nsn-custom-front .newsmatic-section.banner-layout--four,
body.nsn-home.nsn-custom-front .main-banner-wrap,
body.nsn-home.nsn-custom-front .you-may-have-missed-section {
  display: none !important;
}

/* Light page canvas */
body.nsn-home.nsn-custom-front,
body.nsn-home.nsn-custom-front .site-main,
body.nsn-home.nsn-custom-front #content,
body.nsn-home.nsn-custom-front .newsmatic-container {
  background: #f4f7fb !important;
  color: #0f172a;
}

.nsn-home-wrap {
  --pad: clamp(14px, 2.5vw, 24px);
  --nsn-text: #0f172a;
  --nsn-muted: #64748b;
  --nsn-surface: #ffffff;
  --nsn-border: rgba(15, 23, 42, 0.1);
  --nsn-accent: #0284c7;
  --nsn-accent-2: #0ea5e9;
  --nsn-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px var(--pad) 48px;
  color: var(--nsn-text);
}

/* ---------- HERO — ảnh trái cao = 4 dòng phải (JS set height) ---------- */
.nsn-hero {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 14px;
  margin: 10px 0 16px;
  align-items: start;
}

.nsn-hero-main {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--nsn-shadow);
  background: #e2e8f0;
  /* height set by JS to match 4 side rows */
}

.nsn-hero-main a.nsn-hero-link {
  display: block;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

.nsn-hero-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s ease;
}

.nsn-hero-main:hover img {
  transform: scale(1.04);
}

.nsn-hero-main .nsn-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.05) 15%, rgba(15, 23, 42, 0.78) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 14px 16px;
  gap: 4px;
}

.nsn-hero-main .nsn-hero-overlay h1 {
  margin: 0 !important;
  font-size: clamp(0.95rem, 1.6vw, 1.25rem) !important;
  line-height: 1.3 !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em !important;
  color: #fff !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nsn-hero-main .nsn-hero-overlay .nsn-meta {
  color: #e2e8f0 !important;
  font-size: 0.75rem !important;
}

.nsn-hero-main .nsn-hero-overlay p {
  margin: 0 !important;
  color: #e2e8f0 !important;
  font-size: 0.8rem !important;
  line-height: 1.4 !important;
  max-width: 48ch !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nsn-hero-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nsn-hero-side-item {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--nsn-border);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: #0f172a;
  min-height: 48px;
  flex: 1;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.nsn-hero-side-item:hover {
  border-color: rgba(14, 165, 233, 0.45);
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.12);
  transform: translateY(-1px);
}

.nsn-hero-side-item img {
  width: 72px;
  height: 100%;
  object-fit: cover;
  background: #e2e8f0;
}

.nsn-hero-side-item .meta {
  padding: 6px 10px 6px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.nsn-hero-side-item h3 {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.3;
  font-weight: 700;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Ticker ---------- */
.nsn-ticker {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.14), #ffffff);
  border: 1px solid var(--nsn-border);
  border-radius: 999px;
  padding: 6px;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.nsn-ticker-badge {
  flex: 0 0 auto;
  background: #0ea5e9;
  color: #fff;
  font-weight: 800;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 7px 11px;
  border-radius: 999px;
}

.nsn-ticker-track {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.nsn-ticker-track a {
  color: #334155;
  text-decoration: none;
  font-size: 0.88rem;
  margin-right: 24px;
}

.nsn-ticker-track a:hover {
  color: #0284c7;
}

/* ---------- Stats (clickable) ---------- */
.nsn-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 4px 0 20px;
}

a.nsn-stat {
  display: block;
  background: #fff;
  border: 1px solid var(--nsn-border);
  border-radius: 14px;
  padding: 14px 12px;
  text-align: center;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

a.nsn-stat:hover {
  transform: translateY(-2px);
  border-color: rgba(14, 165, 233, 0.45);
  box-shadow: 0 8px 20px rgba(14, 165, 233, 0.12);
}

a.nsn-stat:hover .num {
  color: #0284c7;
}

a.nsn-stat .num {
  font-size: 1.45rem;
  font-weight: 800;
  color: #0ea5e9;
  letter-spacing: -0.03em;
}

a.nsn-stat .label {
  color: #64748b;
  font-size: 0.8rem;
  margin-top: 3px;
  font-weight: 600;
}

a.nsn-stat .hint {
  display: block;
  margin-top: 4px;
  font-size: 0.68rem;
  color: #94a3b8;
  font-weight: 500;
}

a.nsn-stat:hover .hint {
  color: #0284c7;
}

/* ---------- Sections ---------- */
.nsn-section {
  margin-bottom: 28px;
}

.nsn-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--nsn-border);
  padding-bottom: 8px;
}

.nsn-section-head h2 {
  margin: 0;
  font-size: clamp(1.05rem, 1.8vw, 1.3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nsn-section-head h2::before {
  content: "";
  width: 5px;
  height: 1em;
  border-radius: 4px;
  background: linear-gradient(180deg, #38bdf8, #0284c7);
  display: inline-block;
}

.nsn-section-head a.more {
  color: #0284c7;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}

.nsn-section-head a.more:hover {
  color: #0369a1;
}

/* ---------- Category chips ---------- */
.nsn-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.nsn-cats a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--nsn-border);
  color: #334155;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

.nsn-cats a:hover {
  background: rgba(14, 165, 233, 0.1);
  border-color: rgba(14, 165, 233, 0.4);
  color: #0284c7;
}

.nsn-cats a span.count {
  opacity: 0.65;
  font-weight: 500;
  font-size: 0.76rem;
}

/* ---------- Cards ---------- */
.nsn-grid {
  display: grid;
  gap: 14px;
}

.nsn-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.nsn-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.nsn-card {
  background: #fff;
  border: 1px solid var(--nsn-border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  text-decoration: none;
  color: #0f172a;
  height: 100%;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.nsn-card:hover {
  transform: translateY(-3px);
  border-color: rgba(14, 165, 233, 0.4);
  box-shadow: 0 12px 28px rgba(14, 165, 233, 0.12);
}

.nsn-card-thumb {
  aspect-ratio: 16 / 10;
  background: #e2e8f0;
  overflow: hidden;
}

.nsn-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.nsn-card:hover .nsn-card-thumb img {
  transform: scale(1.04);
}

.nsn-card-body {
  padding: 12px 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nsn-card h3 {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.35;
  font-weight: 750;
  letter-spacing: -0.015em;
  color: #0f172a;
}

.nsn-card p.excerpt {
  margin: 0;
  color: #64748b;
  font-size: 0.85rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Pills / meta ---------- */
.nsn-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(90deg, #38bdf8, #0284c7);
  padding: 3px 8px;
  border-radius: 999px;
  width: fit-content;
}

.nsn-pill.is-soft {
  background: rgba(14, 165, 233, 0.12);
  color: #0369a1;
  border: 1px solid rgba(14, 165, 233, 0.22);
}

.nsn-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: #64748b;
  font-size: 0.78rem;
}

/* ---------- Category columns ---------- */
.nsn-cat-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.nsn-cat-col {
  background: #fff;
  border: 1px solid var(--nsn-border);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.nsn-cat-col h3 {
  margin: 0 0 10px;
  font-size: 0.98rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #0f172a;
}

.nsn-cat-col h3 a {
  color: #0284c7;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
}

.nsn-list-item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  text-decoration: none;
  color: #0f172a;
}

.nsn-list-item:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.nsn-list-item img {
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  background: #e2e8f0;
}

.nsn-list-item h4 {
  margin: 0 0 3px;
  font-size: 0.86rem;
  line-height: 1.35;
  font-weight: 650;
}

.nsn-list-item .date {
  color: #94a3b8;
  font-size: 0.72rem;
}

/* ---------- Side panel + compact latest ---------- */
.nsn-latest-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  align-items: start;
}

.nsn-latest-main {
  min-width: 0;
}

/* Compact cards in latest (3 posts) */
.nsn-latest-main .nsn-card-body h3 {
  font-size: 0.95rem;
  -webkit-line-clamp: 2;
}
.nsn-latest-main .nsn-card-body .excerpt {
  font-size: 0.8rem;
  -webkit-line-clamp: 2;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.nsn-latest-main .nsn-card-thumb {
  aspect-ratio: 16 / 10;
  max-height: 140px;
}
.nsn-latest-main .nsn-card-thumb img {
  height: 100%;
  object-fit: cover;
}

.nsn-side-panel {
  background: #fff;
  border: 1px solid var(--nsn-border);
  border-radius: 14px;
  padding: 12px 14px 10px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  min-width: 0;
}

.nsn-side-panel-head h3,
.nsn-side-panel h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: #0f172a;
}

.nsn-side-panel ol,
.nsn-featured-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: nsn;
}

.nsn-side-panel ol li,
.nsn-featured-list li {
  counter-increment: nsn;
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 8px;
  padding: 7px 0;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.nsn-side-panel ol li:first-child,
.nsn-featured-list li:first-child {
  border-top: 0;
  padding-top: 0;
}

.nsn-side-panel ol li::before,
.nsn-featured-list li::before {
  content: counter(nsn, decimal-leading-zero);
  font-weight: 800;
  color: #0ea5e9;
  font-size: 0.78rem;
  padding-top: 2px;
}

.nsn-side-panel ol a,
.nsn-featured-list a {
  color: #0f172a;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.84rem;
  line-height: 1.3;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.nsn-side-panel ol a:hover,
.nsn-featured-list a:hover {
  color: #0284c7;
}

.nsn-feat-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nsn-feat-date {
  font-size: 0.7rem;
  font-weight: 500;
  color: #94a3b8;
}

/* ---------- Pager (Mới cập nhật + Đáng chú ý) ---------- */
.nsn-pager {
  position: relative;
}

.nsn-pager-viewport {
  position: relative;
  min-height: 0;
}

.nsn-pager-page {
  animation: nsn-pager-in 0.28s ease;
}

.nsn-pager-page[hidden] {
  display: none !important;
}

@keyframes nsn-pager-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.nsn-pager-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.nsn-pager-btn {
  appearance: none;
  border: 1px solid var(--nsn-border);
  background: #fff;
  color: #0f172a;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.nsn-pager-btn:hover {
  border-color: rgba(2, 132, 199, 0.45);
  color: #0284c7;
  background: #f0f9ff;
}

.nsn-pager-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.nsn-pager-btn.pause {
  width: auto;
  min-width: 30px;
  padding: 0 8px;
  letter-spacing: 1px;
  font-size: 0.65rem;
}

.nsn-pager-btn.pause.is-paused {
  background: #e0f2fe;
  border-color: rgba(2, 132, 199, 0.35);
  color: #0284c7;
}

.nsn-pager-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0 4px;
}

.nsn-pager-dot {
  appearance: none;
  border: 0;
  padding: 0;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #cbd5e1;
  cursor: pointer;
  transition: width 0.2s ease, background 0.2s ease;
}

.nsn-pager-dot.is-active {
  width: 18px;
  background: #0ea5e9;
}

.nsn-pager-status {
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}

.nsn-pager-list .nsn-pager-nav {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

/* Progress bar for autoplay */
.nsn-pager[data-auto="1"] .nsn-pager-nav {
  position: relative;
}
.nsn-pager-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 2px;
  background: rgba(14, 165, 233, 0.15);
  border-radius: 2px;
  overflow: hidden;
  pointer-events: none;
}
.nsn-pager-progress > i {
  display: block;
  height: 100%;
  width: 0;
  background: #0ea5e9;
  border-radius: 2px;
}

/* ---------- Placeholder ---------- */
.nsn-ph {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #e0f2fe, #f1f5f9 50%, #bae6fd);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0284c7;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.06em;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .nsn-hero {
    grid-template-columns: 1fr;
  }
  .nsn-hero-main,
  .nsn-hero-main a.nsn-hero-link {
    min-height: 180px;
  }
  .nsn-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .nsn-grid-3,
  .nsn-cat-cols {
    grid-template-columns: repeat(2, 1fr);
  }
  .nsn-latest-row {
    grid-template-columns: 1fr;
  }
  .nsn-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .nsn-grid-3,
  .nsn-grid-4,
  .nsn-cat-cols {
    grid-template-columns: 1fr;
  }
  .nsn-hero-side-item {
    grid-template-columns: 64px 1fr;
  }
  .nsn-stats {
    grid-template-columns: 1fr 1fr;
  }
  .nsn-hero-main .nsn-hero-overlay p {
    display: none;
  }
}

/* ---------- Hero side scroller (vùng 2) — ngang bằng cột 1 ---------- */
.nsn-hero-side-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  height: 100%;
  position: relative;
  background: #fff;
  border: 1px solid var(--nsn-border, rgba(15, 23, 42, 0.1));
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  box-sizing: border-box;
}

.nsn-hero-side-controls {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex: 0 0 auto;
}

.nsn-hero-side-btn {
  width: 30px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #f8fafc;
  color: #0f172a;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.nsn-hero-side-btn:hover:not(:disabled) {
  background: #e0f2fe;
  border-color: rgba(14, 165, 233, 0.4);
  color: #0284c7;
}

.nsn-hero-side-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.nsn-hero-side-viewport {
  overflow: hidden;
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.nsn-hero-side-track {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
}

.nsn-hero-side-item {
  flex: 0 0 auto !important;
  min-height: 64px !important;
  height: auto !important;
}

/* mobile: stack */
@media (max-width: 1024px) {
  .nsn-hero-side-wrap {
    max-height: none !important;
    height: auto !important;
  }
}