/* =========================================================
ARTICLES PAGE — CLEAN ORDER (NO FUNCTION CHANGES)
All original rules preserved, only rearranged.
========================================================= */

/* ================= 1. PAGE WRAPPER & SECTION ================= */

.articles-wrapper {
background: var(--bg-tag);
border-radius: 18px;
padding: 55px 36px;
margin-top: 30px;
max-width: 2000px;
margin: 30px auto;
box-shadow: 0 20px 60px rgba(0,0,0,0.12);
}

.articles-section {
margin-top: 40px;
}

/* ================= 2. HEADER ================= */

.articles-header {
display: flex;
flex-direction: column;
gap: 14px;
margin-bottom: 20px;
}

.articles-header-top {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
width: 100%;
}

.articles-header h2 {
font-size: var(--text-xl);
font-weight: 600;
}

/* ================= 3. YEAR FILTER ================= */

.year-scroll {
overflow-x: auto;
overflow-y: hidden;
-webkit-overflow-scrolling: touch;
scrollbar-width: none;
position: relative;
}

.year-scroll::-webkit-scrollbar {
display: none;
}

/* Breakout only inside articles page */
.articles-wrapper .year-scroll {
margin-left: -36px;
margin-right: -36px;
padding: 0 36px 12px;
}

/* Centered version for index */
.articles-section .year-scroll {
margin: 0;
padding: 0 0 12px;
}

.year-filter {
display: flex;
flex-wrap: nowrap;
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;
flex-shrink: 0;
}

.year-filter button.active,
.year-filter button:hover {
background: #f5c542;
color: #000;
border-color: #f5c542;
}

/* Fade edges */
.year-scroll::before,
.year-scroll::after {
content: "";
position: absolute;
top: 0;
bottom: 0;
width: 22px;
pointer-events: none;
z-index: 2;
}

.year-scroll::before {
left: 0;
background: linear-gradient(to right, var(--bg-body), transparent);
}

.year-scroll::after {
right: 0;
background: linear-gradient(to left, var(--bg-body), transparent);
}

/* ================= 4. TAG FILTER ================= */

.tag-scroll {
overflow-x: auto;
overflow-y: hidden;
margin-left: -36px;
margin-right: -36px;
margin-bottom: 0px; 
padding: 0 36px 12px;
padding-top: 6px;
-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;
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;
}

/* ================= 5. GRID ================= */

.result-count {
margin: 6px 2px 0px;
font-size: var(--text-sm);
color: rgba(255,255,255,0.55);
letter-spacing: 0.2px;
}

#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;
gap: var(--space-5);
width: 100%;
max-width: 100%;
align-items: stretch;
}

/* ================= 6. CARD ================= */

.article-card {
background: var(--bg-grid);
border-radius: 16px;
padding: 14px;
display: flex;
flex-direction: column;
height: auto;
box-shadow: 0 8px 10px 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);
}

/* ================= 7. MEDIA ================= */

.article-thumb {
border-radius: 14px;
overflow: hidden;
aspect-ratio: 16 / 9;
margin-bottom: 12px;
}

.article-thumb img {
width: 100%;
height: 200px;
object-fit: cover;
display: block;
}

/* ================= 8. TEXT & TAGS ================= */

.article-body {
display: flex;
flex-direction: column;
flex: 1 1 auto;
min-height: 0;
}

.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;
}

.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;
}

.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;
}

/* ================= 9. INLINE SEARCH ================= */

.search-wrap {
position: relative;
display: inline-flex;
align-items: center;
}


.inline-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 44px 10px 16px;    /* space for ✕ */
  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.35s ease;
}


/* ✨ Focus glow */

.inline-search: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);
}


.inline-search::placeholder {
color: var(--btn-text);
}


/* ===== Fix Chrome autofill white background ===== */
.inline-search:-webkit-autofill,
.inline-search:-webkit-autofill:hover,
.inline-search:-webkit-autofill:focus,
.inline-search:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px var(--bg-search) inset !important;
  box-shadow: 0 0 0 1000px var(--bg-search) inset !important;
  -webkit-text-fill-color: #fff !important;
  transition: background-color 5000s ease-in-out 0s;
}



/* 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,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}

/* ================= 10. RESPONSIVE ================= */

@media (max-width: 768px) {

.articles-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 12px;
align-items: stretch;
}

.article-card {
height: auto;
max-width: 100%;
}

.article-thumb {
aspect-ratio: 1 / 1;
overflow: hidden;
}

.article-thumb img {
width: 100%;
height: 100%;
object-fit: cover;
}
}



/* ===== Empty State ===== */

.no-results {
  text-align: center;
  padding: 40px 10px 10px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.no-results.show {
  opacity: 0.8;
  transform: translateY(0);
}

.no-results-icon {
  font-size: 36px;
  margin-bottom: 8px;
  opacity: 0.9;
}

.no-results h3 {
  font-size: var(--text-lg);
  margin-bottom: 6px;
}

.no-results p {
  font-size: var(--text-sm);
  opacity: 0.6;
}
