/*
 * RIAV — News archive styles.
 *
 * Extracted verbatim from the inline <style> block in tin-tuc.html,
 * then adapted for WordPress output (paginate_links() generates <a> and
 * <span class="current"> inside .pagination rather than <button>/<a>).
 *
 * Depends on: tokens.css, site.css (loaded first via enqueue.php).
 */

/* ---- Featured article ---- */
.featured {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 21 / 9;
  background: #16285A;
  margin-bottom: 56px;
}

@media (max-width: 768px) {
  .featured { aspect-ratio: 4 / 3; }
}

.featured .imgph {
  border: none;
  border-radius: 0;
  height: 100%;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.04) 0 1px, transparent 1px 16px),
    linear-gradient(135deg, #16285A 0%, #0B1B3B 70%, #25386F 100%);
  color: rgba(255,255,255,0.4);
}

.featured .imgph::before {
  border-color: rgba(255,255,255,0.15);
}

/* Featured image fills the container when a real thumbnail is set */
.featured .featured__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.featured__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 30%,
    rgba(11,27,59,0.7) 70%,
    rgba(11,27,59,0.95) 100%
  );
  display: flex;
  align-items: flex-end;
  padding: 32px;
  color: white;
}

@media (min-width: 768px) {
  .featured__overlay { padding: 56px; }
}

.featured__content {
  max-width: 720px;
}

.featured__content .badge {
  background: var(--brand-accent);
  color: var(--brand-primary);
}

.featured__content h2 {
  color: white;
  margin-top: 16px;
  font-size: clamp(1.5rem, 3.5vw, 2.5rem);
  line-height: 1.2;
}

.featured__content h2 a { color: white; }
.featured__content h2 a:hover { color: var(--brand-accent); }

.featured__content .meta {
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  margin-top: 12px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.featured__content p {
  color: rgba(255,255,255,0.85);
  margin-top: 14px;
  max-width: 580px;
  font-size: 16px;
}

/* ---- Filter chips ---- */
.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.filter-chip {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--neutral-200);
  background: white;
  font-size: 14px;
  font-weight: 500;
  color: var(--neutral-700);
  cursor: pointer;
  transition: all var(--t);
  text-decoration: none;
  display: inline-block;
}

.filter-chip:hover {
  border-color: var(--brand-accent);
  color: var(--brand-primary);
  text-decoration: none;
}

.filter-chip[aria-pressed="true"] {
  background: var(--brand-primary);
  color: white;
  border-color: var(--brand-primary);
}

/* ---- News grid ---- */
.news-grid {
  display: grid;
  gap: 24px;
}

@media (min-width: 640px) {
  .news-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .news-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---- News card (.ncard) ---- */
.ncard {
  background: white;
  border: 1px solid var(--neutral-100);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--t), transform var(--t);
}

.ncard:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

/* Thumbnail image produced by the_post_thumbnail() */
.ncard .ncard__thumb {
  aspect-ratio: 16 / 9;
  width: 100%;
  height: auto;        /* override the <img height> attr so aspect-ratio drives the box */
  object-fit: cover;
  display: block;
  border-bottom: 1px solid var(--neutral-100);
}

/* Placeholder when no featured image is set */
.ncard .imgph {
  aspect-ratio: 16 / 9;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid var(--neutral-100);
}

.ncard__body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.ncard__meta {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  color: var(--neutral-500);
}

.ncard h3 {
  font-size: 17px;
  line-height: 1.35;
  margin: 0;
}

.ncard h3 a { color: var(--neutral-900); }
.ncard h3 a:hover { color: var(--brand-primary); }

.ncard p {
  font-size: 14px;
  color: var(--neutral-500);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}

.ncard__more {
  margin-top: auto;
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-accent-700);
  text-decoration: none;
}

.ncard__more:hover {
  color: var(--brand-primary);
  text-decoration: underline;
}

/* ---- Empty state ---- */
.news-empty {
  padding: 40px 0;
  color: var(--neutral-500);
  font-size: var(--fs-body-lg);
}

/* ---- Pagination — adapts paginate_links() output to v1 .pagination look ---- */
/*
 * paginate_links(type=array) emits:
 *   <a href="…">N</a>          — normal page
 *   <span class="current">N</span>  — active page
 *   <span class="dots">…</span>     — ellipsis
 *
 * The prev/next items are also <a> elements here (not <button>).
 * We style them consistently with the v1 design.
 */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.pagination a,
.pagination span {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--t), color var(--t);
}

.pagination a {
  color: var(--neutral-700);
  border: 1px solid var(--neutral-200);
  background: white;
}

.pagination a:hover {
  border-color: var(--brand-accent);
  color: var(--brand-primary);
  background: var(--brand-accent-softer);
}

/* Active page */
.pagination span.current {
  background: var(--brand-primary);
  color: white;
  border: 1px solid var(--brand-primary);
}

/* Ellipsis */
.pagination span.dots {
  border: none;
  color: var(--neutral-500);
  min-width: 24px;
}

/* Prev / next arrows */
.pagination a.prev,
.pagination a.next {
  font-size: 16px;
}

/*
 * Visually hide text that exists for assistive technology (e.g. pagination
 * labels "Trang trước" / "Trang sau"). The clip pattern keeps the text in the
 * accessibility tree while removing it from visual layout; :focus restores
 * visibility so keyboard users can read the label on focus (per _s/underscores).
 */
.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}

.screen-reader-text:focus {
  background-color: #f1f1f1;
  border-radius: 3px;
  box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
  clip: auto !important;
  clip-path: none;
  color: #21759b;
  display: block;
  font-size: 14px;
  font-weight: 700;
  height: auto;
  left: 5px;
  line-height: normal;
  padding: 15px 23px 14px;
  text-decoration: none;
  top: 5px;
  width: auto;
  z-index: 100000;
}
