/* ==============================
   ARTICLES GRID
   ============================== */

.articles-section {
  margin-top: 40px;
}

/* ==============================
   HEADER ROW
============================== */



.articles-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}




.articles-header h2 {
  font-size: var(--text-xl);
  font-weight: 600;
}


/* Top row: title + search */
.articles-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ==============================
   YEAR FILTER
   ============================== */

.year-filter {
  margin-left: auto;      /* push to the right */
  margin-top: 12px;
  margin-bottom: 18px;

  display: flex;
  gap: 8px;
}


.year-filter button {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.15);
  background: var(--bg-yearbtn);
  color: var(--btn-text);
  cursor: pointer;
  font-size: var(--text-sm);
  transition: 0.2s ease;
}

.year-filter button.active,
.year-filter button:hover {
  background: #f5c542;
  color: #000;
  border-color: #f5c542;
}

/* ==============================
   GRID
   ============================== */

.result-count {
  margin: 6px 2px 18px;
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.2px;
}

/* ===== Smooth fade for article grid ===== */
#articlesGrid {
  transition: opacity 0.18s ease;
}

#articlesGrid.is-fading {
  opacity: 0;
}


.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  margin: 0 auto;        /* ⬅️ centers grid */
  gap: var(--space-5);
  align-items: stretch; /* 🔑 REQUIRED */
  
}

/* ==============================
   CARD
   ============================== */

.article-card {
  background: var(--bg-grid);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  height: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  transition: transform .25s ease, box-shadow .25s ease;
}

.article-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 40px rgba(0,0,0,0.45);
}

/* ==============================
   IMAGE
   ============================== */

.article-thumb {
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  margin-bottom: 12px;
}

.article-thumb img {
  width: 100%;
  height: 200px;  /* Manually control image Height not by aspect ratio */
  object-fit: cover;
  display: block;
}

/* ==============================
   BODY (CRITICAL FIX)
   ============================== */

.article-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;     /* allow growth */
  min-height: 0;      /* prevent flex collapse */
}

/* ==============================
   TEXT
   ============================== */

.article-title {
  margin-top: 12px;
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.3;
}

.article-meta {
  font-size: var(--text-sm);
  opacity: 0.7;
  margin-top: 4px;
}

/* ==============================
   TAGS
   ============================== */

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 12px;
}

.article-tag {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #f5c542;
  background: #f6f3ef76;
  color: #000000;
  white-space: nowrap;
}

.article-tag.active {
  background: #f5c842;
  color: #000000;
  border-color: #f5c842;
}


/* ==============================
   READ MORE (NO OVERLAP)
   ============================== */

.article-body .read-more {
  margin-top: auto;
  align-self: flex-start;
  padding: 7px 14px;
  border-radius: 999px;
  background: #2a2f36;
  color: #fff;
  font-size: var(--text-sm);
  text-decoration: none;
  transition: 0.2s ease;
}

.article-body .read-more:hover {
  background: #f5c542;
  color: #000;
}







/* ==============================
   ARTICLES BODY (LIKE 1st IMAGE)
============================== */

.articles-wrapper {
  background: var(--bg-tag);          /* light card like */
  border-radius: 18px;
  padding: 55px 36px;
  margin-top: 30px;
  max-width: 2000px;     /* ⬅️ wider than grid */
  margin: 30px auto;   /* centers wrapper */
  box-shadow: 0 20px 60px rgba(0,0,0,0.12);
}






/* ===============================
   INLINE SEARCH (ARTICLES HEADER)
================================ */

/* search container */
.search-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}


/* === PRIORITY FIRST OVERRIDES BELOW SEARCH CSS === */

.articles-header input[type="text"],
.articles-header input[type="search"] {
  background: var(--bg-search);
  color: #fff;

  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;


  font-size: var(--text-sm);

  min-width: 200px;
  max-width: 240px;

  outline: none;

  padding: 10px 42px 10px 16px;   /* space for ✕ */

  /* Card-like base shadow */
  box-shadow:
    0 0 0 0 rgba(245, 200, 75, 0),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);

  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.35s ease;
}

/* Placeholder */
/* === PRIORITY SET TO 1ST in conflict to below placeholder === */
.articles-header input::placeholder {
  color: var(--btn-text);
}

/* ✨ Focus glow */

.articles-header input:focus {
  background: var(--bg-tag);
  border-color: #f5c84b;

    box-shadow:
    0 0 0 4px rgba(233, 9, 203, 0.18),
    0 0 22px rgba(245, 200, 75, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);

}



/* LESS PRIORITY */

/* Inline search (pill style like 1st image) */
.inline-search {
  margin-left: 10px;
  padding: 8px 18px;
  border-radius: 999px;
  border: none;
  outline: none;
  background: #c83a3a;
  color: #fff;
  font-size: var(--text-sm);
}


.inline-search::placeholder {
  color: rgba(255,255,255,0.8);
}

/* Dark mode tweak */
[data-theme="dark"] .inline-search {
  background: #c83a3a;
}





/* clear button */
.clear-search {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);

  border: none;
  background: transparent;
  color: #aaa;
  font-size: 14px;
  cursor: pointer;

  opacity: 0;              /* hidden by default */
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* show only when input has value */
.search-wrap.has-value .clear-search {
  opacity: 1;
  pointer-events: auto;
}

.clear-search:hover {
  color: #fff;
}



input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}
input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
}





/* ===============================
   TAG SCROLL — UNIVERSAL (DESKTOP + MOBILE)
=============================== */

.tag-scroll {
  overflow-x: auto;        /* ✅ scroll everywhere */
  overflow-y: hidden;

  /* break out of wrapper padding */
  margin-left: -36px;
  margin-right: -36px;
  margin-bottom: 22px;

   /* restore inner spacing */
  padding: 0 36px 12px;

  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tag-scroll::-webkit-scrollbar {
  display: none;
}


.tag-filter {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(1, auto);
  grid-auto-columns: max-content; /* 🔥 REQUIRED */
  gap: 8px 10px;
}



/* ===============================
   TAG ARROWS (DESKTOP ONLY)
=============================== */

.tag-scroll-wrapper {
  position: relative;
}

/* Hide arrows by default (mobile + touch) */
.tag-arrow {
  display: none;
}

/* Enable arrows ONLY on desktop devices */
@media (hover: hover) and (pointer: fine) {
  .tag-arrow {
    display: flex;
    align-items: center;
    justify-content: center;

    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;

    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;

    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 22px;
    cursor: pointer;

    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .tag-arrow.left {
    left: 8px;
  }

  .tag-arrow.right {
    right: 8px;
  }

  /* show arrows on hover */
  .tag-scroll-wrapper:hover .tag-arrow {
    opacity: 1;
    pointer-events: auto;
  }
}





.tag-btn {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.75rem;

  background: var(--bg-tag);
  color: var(--tag-text);
  border: 1px solid var(--accent);

  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.tag-btn:hover {
  background: var(--btn-hover);
  color: var(--btn-hover-text);
}

.tag-btn.active {
  background: var(--tag-active);
  color: #000;
}
















/* ===============================
   MOBILE: FORCE 2-COLUMN GRID
=============================== */
@media (max-width: 768px) {

  .articles-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 🔥 exactly 2 columns */
    gap: 12px;
    align-items: stretch;        /* 🔑 force equal row height */
  
  }

  /* Make sure cards fit nicely */
  .article-card {
    height: auto;                /* 🔑 fill grid row */
    max-width: 100%;
    
  }

  .article-thumb {
    aspect-ratio: 1 / 1;
    overflow: hidden;
  }

  /* Reduce image height for mobile balance */
  .article-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }




  
}
