/* ============================================================
   GLOBAL FONTS & RESET
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&display=swap');

:root {
  --fond: #173D5D;
  --orange: #e19d3a;
  --ocre: #ab5921;
  --header-bg: #173D5D;
  --header-text: #ffffff;
  --footer-bg: #173D5D;
  --footer-text: #ffffff;
  --body-bg: #f0f2f5;
  --card-bg: #ffffff;
  --text-color: #4a567f;
  --heading-color: #173D5D;
  --secondary: #e19d3a;
  --accent: #ab5921;
  --font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  /* ── Heading typography scale ── */
  --heading-font: 'Tajawal', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --h1-size: 1.5rem;
  --h2-size: 1.25rem;
  --h3-size: 1.0rem;
  --h4-size: 1.0rem;
  --h5-size: 0.8rem;
  --heading-weight: 700;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-hover: 0 6px 24px rgba(0,0,0,0.13);
  --transition: 0.22s ease;
  --bottom-nav-h: 62px;
}

* { margin:0; padding:0; box-sizing:border-box; }

/* clip = blocks horizontal scroll WITHOUT breaking position:sticky (unlike hidden) */
html, body { overflow-x: clip; }

body {
  font-family: var(--font-family);
  color: var(--text-color);
  background: var(--body-bg);
  padding-bottom: var(--bottom-nav-h);
}

a { text-decoration:none; color:var(--text-color); }
a:hover { opacity:0.82; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--heading-font);
  color: var(--heading-color);
  font-weight: var(--heading-weight);
  line-height: 1.3;
}

/* ============================================================
   NAV TOP  —  2-row layout: header (logo centré) + categories bar
   ============================================================ */
nav {
  position: sticky; top:0; left:0; width:100%;
  background: var(--header-bg); z-index:99;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* ── Row 1 : Header (logo centré via flex:1 trick) ── */
.nav-header {
  height: 56px;
  width:100%; padding:0 16px;
  display: flex; align-items: center;
}
/*
  KEY: hamburger + lang-select both have flex:1
  → logo is sandwiched between two equal-width sides → always perfectly centered
  On desktop: hamburger is visibility:hidden (takes space, invisible)
  On mobile:  hamburger is visibility:visible
*/
.nav-header .hamburger {
  display: flex !important;   /* override global display:none — must keep space */
  visibility: hidden;
  flex: 1 0 0; min-width: 0;
}
.nav-header .logo {
  flex: 0 0 auto; white-space: nowrap; padding: 0 4px;
}
.nav-header .logo a {
  font-size: 22px; color: #fff; font-weight: 800; letter-spacing: -0.3px;
}
.nav-header .nav-lang-select {
  flex: 1 0 0; min-width: 0;
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px;
}
.nav-lang-select select {
  background: transparent; color: #fff;
  border: 1px solid rgba(255,255,255,0.35); border-radius: 6px;
  padding: 0.2rem 0.45rem; font-size: 0.75rem; cursor: pointer;
  font-family: var(--font-family);
}

/* ── Row 2 : Categories bar ── */
.nav-categories {
  background: rgba(0,0,0,0.18);
  border-top: 1px solid rgba(255,255,255,0.1);
  overflow-x: auto; scrollbar-width:none; -ms-overflow-style:none;
}
.nav-categories::-webkit-scrollbar { display:none; }
.nav-cats-list {
  display:flex; list-style:none; align-items:stretch;
  max-width:1400px; margin:auto; padding:0 8px;
  height:40px; white-space:nowrap;
}
.nav-cats-list li { position:relative; display:flex; align-items:center; }
.nav-cats-list li a {
  color:rgba(255,255,255,0.88); font-size:12.5px; font-weight:500;
  white-space:nowrap; padding:0 10px; height:100%; display:flex; align-items:center;
  transition: color 0.15s, background 0.15s;
  border-radius:0;
}
.nav-cats-list li a:hover { color:#fff; background:rgba(255,255,255,0.1); }
.nav-cats-list li a.active { color:#fff; font-weight:700; border-bottom:2px solid #fff; }
.nav-cats-list li.nav-special a {
  background:rgba(255,255,255,0.12); border-radius:4px; margin:0 3px;
  padding:0 9px; color:#fff;
}
.nav-cats-list li .arrow { color:rgba(255,255,255,0.7); font-size:9px; margin-left:2px; }
.nav-cats-list li .sub-menu {
  position:absolute; top:100%; left:0; line-height:36px;
  background:var(--fond); box-shadow:0 4px 12px rgba(0,0,0,0.25);
  border-radius:0 0 8px 8px; display:none; z-index:10; min-width:155px;
}
.nav-cats-list li:hover .sub-menu { display:block; }
.nav-cats-list li .sub-menu li { padding:0; border-bottom:1px solid rgba(255,255,255,0.1); height:auto; }
.nav-cats-list li .sub-menu li:last-child { border-bottom:none; }
.nav-cats-list li .sub-menu a { font-size:13px; display:block; padding:0 16px; border-radius:0; }

/* ── Search toggle button (in nav-header, beside hamburger/lang-select) ── */
.nav-search-toggle {
  background: rgba(255,255,255,0.15); border: none; border-radius: 50%;
  width: 32px; height: 32px; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; transition: background 0.2s; flex-shrink: 0;
}
.nav-search-toggle:hover { background: rgba(255,255,255,0.28); }

.nav-saved-btn {
  background: rgba(255,255,255,0.15); border: none; border-radius: 20px;
  padding: 0 0.7rem; height: 32px; color: #fff; cursor: pointer;
  display: flex; align-items: center; gap: 0.3rem;
  font-size: 0.85rem; transition: background 0.2s; flex-shrink: 0;
  white-space: nowrap;
}
.nav-saved-btn:hover { background: rgba(255,255,255,0.28); }
.nav-saved-count {
  background: var(--orange); color: #fff; border-radius: 10px;
  padding: 0 5px; font-size: 0.72rem; font-weight: 700; min-width: 18px;
  text-align: center;
}
@media (max-width: 700px) { .nav-saved-btn { display: none; } }

/* ── Search overlay (fullscreen modal) ── */
.search-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.55); z-index: 300;
  align-items: flex-start; justify-content: center;
  padding-top: 56px;
}
.search-overlay.open { display: flex; }
.search-overlay-box {
  width: 100%; max-width: 640px;
  background: var(--header-bg);
  padding: 0.75rem 1rem;
  display: flex; align-items: center; gap: 0.5rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
}
.search-overlay-input {
  flex: 1; border: none; background: rgba(255,255,255,0.12);
  color: #fff; border-radius: 20px; padding: 0.5rem 1rem;
  font-size: 0.95rem; font-family: var(--font-family); outline: none;
}
.search-overlay-input::placeholder { color: rgba(255,255,255,0.5); }
.search-overlay-submit {
  background: var(--orange); border: none; border-radius: 20px;
  color: #fff; padding: 0.45rem 1.1rem; font-size: 0.88rem;
  cursor: pointer; font-family: var(--font-family); font-weight: 700;
  transition: opacity 0.2s; white-space: nowrap;
}
.search-overlay-submit:hover { opacity: 0.88; }
.search-overlay-close {
  background: rgba(255,255,255,0.12); border: none; border-radius: 50%;
  width: 32px; height: 32px; color: #fff; cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* ── Mobile search bar — REMOVED (replaced by overlay) ── */
.mobile-search-bar { display: none !important; }

/* ── Search results header ── */
.search-results-header {
  display:flex; align-items:center; gap:0.5rem; flex-wrap:wrap;
  background:#fff; border-radius:var(--radius); padding:0.65rem 1rem;
  margin-bottom:0.6rem; font-size:0.88rem; color:#555;
  box-shadow:var(--shadow);
}
.search-results-header strong { color:var(--heading-color); }
.search-count { color:#aaa; font-size:0.82rem; }
.search-clear {
  margin-inline-start:auto; background:#f0f2f5; border-radius:20px;
  padding:0.2rem 0.7rem; font-size:0.78rem; color:#888;
  transition: background 0.2s;
}
.search-clear:hover { background:#e2e5ea; color:#555; }

/* ── Search keyword highlight ── */
mark.search-hl {
  background: #fff0b3;
  color: var(--heading-color);
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 700;
  font-style: normal;
}

/* ============================================================
   SHARE BAR
   ============================================================ */
.share-bar {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  margin: 0.9rem 0;
  padding: 0.65rem 0.9rem;
  background: #f7f9fc;
  border-radius: var(--radius);
  border: 1px solid #e8ecf2;
}
.share-label {
  font-size: 0.8rem; color: #888; font-weight: 600;
  margin-inline-end: 0.2rem; flex-shrink: 0;
}
.share-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  border: none; cursor: pointer; transition: transform 0.18s, opacity 0.18s;
  flex-shrink: 0; text-decoration: none;
}
.share-btn svg { width: 18px; height: 18px; }
.share-btn:hover { transform: translateY(-2px); opacity: 0.88; }

.share-wa   { background: #25D366; color: #fff; }
.share-tg   { background: #0088cc; color: #fff; }
.share-x    { background: #000;    color: #fff; }
.share-fb   { background: #1877F2; color: #fff; }
.share-copy { background: #f0f2f5; color: #555; }
.share-copy.copied { background: #27ae60; color: #fff; }

/* ============================================================
   MOST READ SECTION
   ============================================================ */
.most-read-section {
  background: #fff; border-radius: var(--radius);
  padding: 1rem; margin-top: 1rem;
  box-shadow: var(--shadow);
}
.most-read-title {
  font-size: var(--h3-size);
  margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.4rem;
}
.most-read-list {
  list-style: none; display: flex; flex-direction: column; gap: 0.1rem;
}
.most-read-item {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid #f0f2f5;
}
.most-read-item:last-child { border-bottom: none; }

.mr-rank {
  font-size: 1.25rem; font-weight: 900; color: #ddd;
  min-width: 24px; text-align: center; flex-shrink: 0; line-height: 1;
}
.most-read-item:nth-child(1) .mr-rank { color: #f39c12; }
.most-read-item:nth-child(2) .mr-rank { color: #95a5a6; }
.most-read-item:nth-child(3) .mr-rank { color: #cd7f32; }

.mr-content {
  display: flex; align-items: center; gap: 0.55rem;
  flex: 1; min-width: 0; text-decoration: none;
}
.mr-content:hover .mr-title { color: var(--orange); }

.mr-img {
  width: 54px; height: 54px; object-fit: cover;
  border-radius: 8px; flex-shrink: 0;
}
.mr-text { flex: 1; min-width: 0; }
.mr-title {
  font-size: 0.85rem; font-weight: 700; color: var(--heading-color);
  line-height: 1.35; margin-bottom: 0.25rem;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  transition: color 0.18s;
}
.mr-meta {
  display: flex; align-items: center; gap: 0.3rem;
  font-size: 0.72rem; color: #aaa;
}
.mr-views { margin-inline-start: auto; color: var(--orange); font-weight: 600; }

/* ============================================================
   LOCAL NEWS SECTION
   ============================================================ */
.local-news-section {
  background: #fff; border-radius: var(--radius);
  padding: 1rem; margin-top: 1rem;
  box-shadow: var(--shadow);
}
.local-news-title {
  font-size: var(--h3-size);
  margin-bottom: 0.75rem;
  display: flex; align-items: center; gap: 0.5rem;
  flex-wrap: wrap;
}
.local-country-badge {
  background: linear-gradient(135deg, var(--fond), var(--orange));
  color: #fff; font-size: 0.72rem; font-weight: 700;
  padding: 0.15rem 0.65rem; border-radius: 20px;
  letter-spacing: 0.02em;
}
.local-news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.65rem;
}
.local-news-card {
  display: flex; align-items: center; gap: 0.55rem;
  text-decoration: none; border-radius: 10px;
  padding: 0.4rem; transition: background 0.18s;
  border: 1px solid #f0f2f5;
}
.local-news-card:hover { background: #f7f8fa; }
.local-news-img {
  width: 64px; height: 64px; object-fit: cover;
  border-radius: 8px; flex-shrink: 0;
}
.local-no-img {
  width: 64px; height: 64px; border-radius: 8px; flex-shrink: 0;
}
.local-news-body { flex: 1; min-width: 0; }
.local-news-title-text {
  font-size: 0.82rem; font-weight: 700; color: var(--heading-color);
  line-height: 1.35; margin: 0 0 0.25rem;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  transition: color 0.18s;
}
.local-news-card:hover .local-news-title-text { color: var(--orange); }
.local-news-meta {
  display: flex; align-items: center; gap: 0.3rem;
  font-size: 0.71rem; color: #aaa;
}

@media (max-width: 700px) {
  .local-news-grid {
    grid-template-columns: 1fr;
  }
}

/* Legacy .navbar — kept for compatibility (not used in main nav) */
.navbar { display:none; }

/* ============================================================
   BACK TO TOP BUTTON (floating)
   ============================================================ */
.btn-back-top {
  position: fixed;
  bottom: 20px;
  inset-inline-end: 20px;      /* right on LTR, left on RTL — auto-handled */
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--fond);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  box-shadow: 0 4px 18px rgba(0,0,0,0.28);
  z-index: 130;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.28s ease, transform 0.28s ease, background 0.2s;
}
.btn-back-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.btn-back-top:hover {
  background: var(--orange);
  transform: translateY(-3px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.35);
}
@media (max-width: 700px) {
  .btn-back-top { bottom: calc(var(--bottom-nav-h) + 14px); }
}

/* ============================================================
   HAMBURGER + MOBILE OVERLAY
   ============================================================ */
.hamburger {
  display:none; flex-direction:column; gap:5px; cursor:pointer; padding:4px;
}
.hamburger span { display:block; width:22px; height:2px; background:#fff; border-radius:2px; transition: var(--transition); }

.mobile-overlay {
  display:none; position:fixed; top:0; left:-290px; width:290px; height:100%;
  background:var(--fond); z-index:200; padding:1.2rem; transition:left 0.28s cubic-bezier(.4,0,.2,1);
  overflow-y:auto;
}
.mobile-overlay.open { left:0; display:block; }
.mobile-overlay .close-btn { color:#fff; font-size:26px; cursor:pointer; text-align:right; margin-bottom:1.2rem; display:block; }
.mobile-overlay a { display:block; color:#fff; padding:0.65rem 0; border-bottom:1px solid rgba(255,255,255,0.1); font-size:15px; font-weight:500; }
.overlay-bg {
  display:none; position:fixed; top:0; left:0; width:100%; height:100%;
  background:rgba(0,0,0,0.5); z-index:199; backdrop-filter:blur(2px);
}
.overlay-bg.show { display:block; }

/* ============================================================
   CATEGORY FILTER CHIPS (horizontal scroll bar)
   ============================================================ */
.cat-chips-bar {
  display:none; gap:0.5rem; overflow-x:auto; padding:0.7rem 1rem;
  scrollbar-width:none; -ms-overflow-style:none;
  background:#fff; border-bottom:1px solid #eee; position:sticky; top:96px; z-index:90;
  width:100%;
}
.cat-chips-bar::-webkit-scrollbar { display:none; }
.cat-chip {
  flex-shrink:0; padding:0.3rem 0.85rem; border-radius:20px; font-size:0.8rem;
  font-weight:600; cursor:pointer; border:2px solid transparent;
  background:#f0f2f5; color:#555; transition: var(--transition);
  font-family: var(--font-family);
}
.cat-chip:hover { opacity:0.85; }
.cat-chip.active { color:#fff; border-color:transparent; }
/* ── Special chip: World Cup schedule link ── */
.cat-chip-special {
  background: linear-gradient(135deg, #c0392b, #e74c3c);
  color: #fff !important; border-color: transparent;
  text-decoration: none; font-weight: 700;
  box-shadow: 0 2px 6px rgba(192,57,43,0.3);
}
.cat-chip-special:hover { opacity: 0.88; }

/* ============================================================
   CONTAINERS
   ============================================================ */
.container {
  max-width:1140px; margin:0 auto; background:#fff;
  padding:1rem; border-radius:0; margin-bottom:0.5rem;
}
.page-container { max-width:1140px; margin:0 auto; padding:0.8rem; }

/* ============================================================
   FEATURED ARTICLE
   ============================================================ */
.featured-article {
  display:block; border-radius:var(--radius); overflow:hidden;
  margin-bottom:1rem; background:var(--card-bg);
  box-shadow:var(--shadow); transition: var(--transition);
}
.featured-article:hover { box-shadow:var(--shadow-hover); transform:translateY(-2px); }
.featured-article img {
  width:100%; max-height:320px; object-fit:cover;
}
.featured-article .feat-body { padding:0.9rem 1rem; }
.featured-article h2 { font-size:var(--h2-size); margin-bottom:0.4rem; }
.featured-article .feat-summary { font-size:0.88rem; color:#666; line-height:1.6; }
.featured-article .feat-meta { display:flex; gap:0.5rem; align-items:center; margin-top:0.5rem; font-size:0.75rem; color:#999; flex-wrap:wrap; }

/* ============================================================
   ARTICLE GRID
   ============================================================ */
.article-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:0.85rem; }

/* KEY FIX: grid items must have min-width:0 so 1fr columns don't expand beyond the grid */
.article-card-link {
  display: block;
  min-width: 0;
  overflow: hidden;
}

.article-card {
  display:flex; flex-direction:column; background:var(--card-bg);
  border-radius:var(--radius); overflow:hidden; box-shadow:var(--shadow);
  transition:transform var(--transition), box-shadow var(--transition);
  position:relative; cursor:pointer; height:100%;
}
.article-card:hover { transform:translateY(-3px); box-shadow:var(--shadow-hover); }
.article-card img {
  width:100%; height:155px; object-fit:cover;
}
.article-card .no-img {
  height:120px; background:linear-gradient(135deg,#e8ecf0,#d0d8e0);
  display:flex; align-items:center; justify-content:center; color:#aaa; font-size:0.85rem;
}
.article-card .card-body { padding:0.65rem 0.75rem 0.8rem; flex:1; display:flex; flex-direction:column; }
.article-card .card-body h4 {
  font-family: 'Tajawal', sans-serif;
  font-size:var(--h4-size); font-weight:800; line-height:1.4;
  overflow-wrap: break-word; word-break: break-word;
  color: #1a2332;
}
.article-card .card-summary {
  font-size:0.78rem; color:#777; line-height:1.5; margin-top:0.3rem;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
  overflow-wrap: break-word; word-break: break-word;
}
.article-card .meta { font-size:0.72rem; color:#aaa; margin-top:0.4rem; display:flex; align-items:center; gap:0.3rem; flex-wrap:wrap; }
.article-card .cat-dot {
  display:inline-block; width:8px; height:8px; border-radius:50%; flex-shrink:0;
}

/* save button on card */
.btn-save-card {
  position:absolute; top:8px; right:8px; background:rgba(255,255,255,0.92);
  border:none; border-radius:50%; width:32px; height:32px; cursor:pointer;
  font-size:15px; display:flex; align-items:center; justify-content:center;
  box-shadow:0 2px 6px rgba(0,0,0,0.15); transition: opacity 0.2s, transform 0.2s;
  z-index:2; opacity:0.45;
}
.btn-save-card.saved { opacity:1; }
.btn-save-card:hover { opacity:0.85; }
.btn-reaction {
  background:none; border:none; cursor:pointer; font-size:1.15rem;
  padding:0 0.15rem; opacity:0.4; transition: opacity 0.2s, transform 0.2s;
  line-height:1;
}
.btn-reaction:hover { opacity:0.75; }
.btn-save-card:hover { transform:scale(1.15); }
.btn-save-card.saved { color:#e74c3c; }

/* swipe animation */
.article-card.swipe-right {
  animation: swipeRight 0.35s ease forwards;
}
.article-card.swipe-left {
  animation: swipeLeft 0.35s ease forwards;
}
@keyframes swipeRight {
  to { transform:translateX(120%) rotate(15deg); opacity:0; }
}
@keyframes swipeLeft {
  to { transform:translateX(-120%) rotate(-15deg); opacity:0; }
}

/* ============================================================
   SECTION TITLE
   ============================================================ */
.section-title {
  font-size:var(--h3-size); margin-bottom:0.7rem;
  border-right:4px solid var(--secondary); padding-right:0.5rem;
  display:flex; align-items:center; gap:0.5rem;
}
[dir=ltr] .section-title { border-right:none; border-left:4px solid var(--secondary); padding-left:0.5rem; }

/* ============================================================
   ARTICLE PAGE
   ============================================================ */
.article-full { max-width:820px; margin:0 auto; }
.article-full > img {
  width:100%; border-radius:var(--radius); margin-bottom:1rem;
  box-shadow:var(--shadow); max-height:400px; object-fit:cover;
}
.article-full h1 { font-size:var(--h1-size); margin-bottom:0.5rem; line-height:1.35; font-weight:800; }
.article-full .meta-bar {
  display:flex; flex-wrap:wrap; gap:0.5rem; font-size:0.8rem;
  color:#999; margin-bottom:1rem; align-items:center;
}
.article-full .meta-bar .cat-badge {
  padding:0.2rem 0.65rem; border-radius:20px; color:#fff; font-weight:700; font-size:0.75rem;
}
.article-full .article-body { line-height:1.85; font-size:1.02rem; color:#333; font-weight:400; }

/* ── Summary Box ─────────────────────────── */
.summary-box {
  background:linear-gradient(135deg, #f0f7ff, #e8f4fd);
  border-right:4px solid var(--fond); border-radius:var(--radius);
  padding:1rem 1.1rem; margin-bottom:1.2rem;
}
[dir=ltr] .summary-box { border-right:none; border-left:4px solid var(--fond); }
.summary-box .summary-label {
  font-size:0.72rem; font-weight:700; color:var(--fond); letter-spacing:0.5px;
  text-transform:uppercase; margin-bottom:0.4rem; display:flex; align-items:center; gap:0.3rem;
}
.summary-box p { font-size:0.92rem; line-height:1.7; color:#333; font-weight:500; }

/* ── Read More Button ────────────────────── */
.btn-view-original {
  display:flex; align-items:center; justify-content:center; gap:0.45rem;
  width:100%; background:var(--fond); color:#fff;
  padding:0.75rem 1.5rem; border-radius:20px;
  font-weight:700; font-size:0.95rem; text-decoration:none;
  transition:opacity 0.2s, transform 0.15s; margin-bottom:1.2rem;
  box-shadow:0 3px 10px rgba(23,61,93,0.18);
}
.btn-view-original:hover { opacity:0.88; color:#fff; transform:translateY(-1px); }

/* ── Article Bookmark Button ─────────────── */
.btn-art-save {
  display:inline-flex; align-items:center; gap:0.35rem;
  padding:0.3rem 0.9rem; border-radius:20px; cursor:pointer; border:none;
  font-size:0.8rem; font-weight:700; font-family:var(--font-family);
  background:#f0f2f5; color:#777;
  transition:background 0.2s, color 0.2s, transform 0.15s;
  line-height:1;
}
.btn-art-save:hover { background:#e2e5ea; color:#555; }
.btn-art-save.saved {
  background:linear-gradient(135deg,#f39c12,#e67e22);
  color:#fff;
  box-shadow:0 2px 8px rgba(230,126,34,0.35);
}
.btn-art-save .save-icon { font-size:0.95rem; transition:transform 0.2s; }
.btn-art-save.saved .save-icon { transform:scale(1.15); }

/* ── Related Sources Section ─────────────── */
.related-sources {
  margin-top:2rem; padding-top:1rem; border-top:2px solid #eee;
}
.related-sources h3 { font-size:var(--h3-size); margin-bottom:0.8rem; }
.related-sources-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:0.6rem; }
.related-card {
  display:flex; gap:0.6rem; padding:0.7rem; background:#f8f9fa;
  border-radius:8px; border:1px solid #eee; transition: var(--transition);
  align-items:flex-start;
}
.related-card:hover { background:#f0f2f5; }
.related-card img { width:60px; height:48px; object-fit:cover; border-radius:6px; flex-shrink:0; }
.related-card .rc-body { flex:1; min-width:0; }
.related-card h5 { font-size:var(--h5-size); line-height:1.35; font-weight:600; margin-bottom:0.2rem;
  overflow:hidden; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
.related-card .rc-src { font-size:0.7rem; color:var(--orange); font-weight:600; }
.btn-back {
  display:inline-flex; align-items:center; gap:0.3rem; margin-top:1.2rem;
  padding:0.45rem 1rem; background:var(--fond); color:#fff;
  border-radius:20px; font-size:0.85rem; font-weight:600; transition: var(--transition);
}
.btn-back:hover { opacity:0.88; color:#fff; }

/* ============================================================
   PERSONALIZATION MODAL
   ============================================================ */
.modal-overlay {
  display:none; position:fixed; inset:0; background:rgba(0,0,0,0.6);
  z-index:500; align-items:center; justify-content:center;
  backdrop-filter:blur(4px);
}
.modal-overlay.open { display:flex; }
.modal-box {
  background:#fff; border-radius:20px; padding:1.8rem;
  max-width:480px; width:90%; max-height:85vh; overflow-y:auto;
  box-shadow:0 20px 60px rgba(0,0,0,0.25); animation: modalIn 0.3s ease;
}
@keyframes modalIn { from { transform:translateY(30px); opacity:0; } to { transform:translateY(0); opacity:1; } }
.modal-box h2 { font-size:var(--h2-size); margin-bottom:0.3rem; }
.modal-box p { color:#777; font-size:0.88rem; margin-bottom:1.2rem; line-height:1.5; }
.topics-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:0.6rem; margin-bottom:1.3rem; }
.topic-btn {
  display:flex; align-items:center; gap:0.5rem; padding:0.65rem 0.8rem;
  border:2px solid #e0e0e0; border-radius:10px; cursor:pointer; background:#fff;
  font-family:var(--font-family); font-size:0.88rem; font-weight:600; color:#444;
  transition: var(--transition); text-align:start;
}
.topic-btn:hover { border-color:var(--fond); }
.topic-btn.selected { background:var(--fond); color:#fff; border-color:var(--fond); }
.topic-btn .topic-dot { width:10px; height:10px; border-radius:50%; flex-shrink:0; }
.btn-modal-confirm {
  width:100%; padding:0.75rem; background:var(--fond); color:#fff;
  border:none; border-radius:10px; font-size:1rem; font-weight:700;
  cursor:pointer; font-family:var(--font-family); transition: var(--transition);
}
.btn-modal-confirm:hover { opacity:0.9; }
.btn-modal-skip { display:block; text-align:center; margin-top:0.8rem; color:#aaa; font-size:0.82rem; cursor:pointer; }
.btn-modal-skip:hover { color:#666; }

/* ============================================================
   BOTTOM NAVIGATION (mobile only)
   ============================================================ */
.bottom-nav {
  display:none; position:fixed; top:auto; bottom:0; left:0; right:0;
  height:var(--bottom-nav-h); background:#fff;
  border-top:1px solid #e8e8e8; z-index:150;
  box-shadow:0 -4px 16px rgba(0,0,0,0.08);
}
.bottom-nav-inner {
  display:flex; height:100%; max-width:480px; margin:0 auto;
}
.bn-item {
  flex:1; display:flex; flex-direction:column; align-items:center;
  justify-content:center; gap:3px; cursor:pointer; border:none;
  background:transparent; font-family:var(--font-family);
  color:#999; font-size:0.65rem; font-weight:600; transition:color var(--transition);
  -webkit-tap-highlight-color:transparent; padding-bottom:env(safe-area-inset-bottom,0);
}
.bn-item.active { color:var(--fond); }
.bn-item .bn-icon { font-size:22px; line-height:1; }
.bn-badge {
  position:absolute; top:-3px; right:-4px;
  background:#e74c3c; color:#fff; border-radius:10px;
  font-size:0.6rem; padding:1px 4px; font-weight:700; min-width:16px; text-align:center;
}
.bn-icon-wrap { position:relative; }

/* ============================================================
   OFFLINE BANNER
   ============================================================ */
.offline-banner {
  display:none; position:fixed; top:96px; left:0; right:0; z-index:95;
  background:#e74c3c; color:#fff; text-align:center; padding:0.5rem 1rem;
  font-size:0.85rem; font-weight:600;
}
.offline-banner.show { display:block; }

/* ============================================================
   SAVED ARTICLES VIEW
   ============================================================ */
.saved-view {
  display:none; position:fixed; top:0; right:0; bottom:0; left:0;
  background:var(--body-bg); z-index:140; overflow-y:auto; padding-top:0;
}
.saved-view.open { display:block; }
.saved-view-header {
  background:#fff; padding:1rem; display:flex; align-items:center; gap:1rem;
  border-bottom:1px solid #eee; position:sticky; top:0; z-index:2;
}
.saved-view-header h2 { font-size:var(--h2-size); flex:1; }
.btn-close-saved { background:none; border:none; font-size:22px; cursor:pointer; color:#666; }
.saved-empty { text-align:center; padding:3rem 1rem; color:#aaa; }
.saved-empty .empty-icon { font-size:3rem; margin-bottom:0.5rem; }

/* ============================================================
   DISCOVERY (SWIPE) MODE
   ============================================================ */
.discovery-overlay {
  display:none; position:fixed; inset:0; background:var(--body-bg);
  z-index:145; flex-direction:column; align-items:center; justify-content:center;
  padding:1rem;
}
.discovery-overlay.open { display:flex; }
.disc-card {
  width:100%; max-width:360px; background:#fff; border-radius:20px;
  box-shadow:0 8px 32px rgba(0,0,0,0.14); overflow:hidden; user-select:none;
  touch-action:none; position:relative; transition:none;
}
.disc-card img { width:100%; height:220px; object-fit:cover; }
.disc-card-body { padding:1.1rem; }
.disc-card-body h3 { font-size:var(--h3-size); line-height:1.35; margin-bottom:0.4rem; }
.disc-card-body .disc-src { font-size:0.78rem; color:var(--orange); font-weight:600; }
.disc-actions {
  display:flex; justify-content:center; gap:1.5rem; margin-top:1.2rem;
}
.disc-btn {
  width:56px; height:56px; border-radius:50%; border:none; font-size:24px;
  cursor:pointer; display:flex; align-items:center; justify-content:center;
  box-shadow:var(--shadow); transition: var(--transition);
}
.disc-btn:active { transform:scale(0.92); }
.disc-btn-skip { background:#fff; color:#e74c3c; }
.disc-btn-save { background:var(--fond); color:#fff; }
.disc-btn-read { background:var(--orange); color:#fff; font-size:18px; }
.disc-hint { font-size:0.78rem; color:#aaa; margin-top:0.8rem; }
.disc-progress { font-size:0.82rem; color:#999; margin-bottom:0.8rem; font-weight:500; }
.btn-close-disc {
  position:absolute; top:12px; left:12px; background:rgba(255,255,255,0.9);
  border:none; border-radius:50%; width:36px; height:36px; font-size:18px;
  cursor:pointer; display:flex; align-items:center; justify-content:center;
  z-index:5; box-shadow:var(--shadow);
}

/* swipe direction indicators */
.disc-card .indicator-save,
.disc-card .indicator-skip {
  position:absolute; top:20px; padding:0.4rem 0.8rem;
  border-radius:8px; font-weight:800; font-size:1.1rem;
  opacity:0; transition:opacity 0.1s; z-index:3; pointer-events:none;
}
.disc-card .indicator-save { right:16px; background:#27ae60; color:#fff; border:3px solid #27ae60; }
.disc-card .indicator-skip { left:16px; background:#e74c3c; color:#fff; border:3px solid #e74c3c; }

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  background:var(--footer-bg); color:var(--footer-text); text-align:center;
  padding:1rem; font-size:0.85rem; margin-top:0.5rem;
}
footer a { color:rgba(255,255,255,0.8); }
footer a:hover { color:#fff; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .article-grid { grid-template-columns: repeat(3, 1fr); }
  .related-sources-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  /* ── 1 card per row, horizontal layout ── */
  .article-grid { grid-template-columns: 1fr; gap:0.55rem; }
  .article-card {
    flex-direction: row;
    height: auto;
    min-height: 100px;
  }
  .article-card img {
    width: 115px; height: 100%; min-height: 100px;
    flex-shrink: 0; object-fit: cover; border-radius: 0;
  }
  .article-card .no-img {
    width: 115px; min-height: 100px; height: auto;
    flex-shrink: 0; border-radius: 0; font-size: 1.4rem;
  }
  .article-card .card-body {
    padding: 0.6rem 0.7rem;
    justify-content: space-between;
  }
  .article-card .card-body h4 {
    font-size: 0.88rem;
    -webkit-line-clamp: 3;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .article-card .card-summary { display: none; }

  /* ── Nav / UI ── */
  .nav-categories { display:none; }
  .nav-header .hamburger { visibility:visible; flex:0 0 auto; }
  .bottom-nav { display:block; }
  .cat-chips-bar { display:flex; top:56px; }
  .offline-banner { top:56px; }
  .saved-view { padding-top:0; }
  .saved-view-header { top:0; }
  .topics-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .article-card img { width:100px; }
  .article-card .no-img { width:100px; }
  .article-card .card-body h4 { font-size:0.84rem; }
  .container { padding:0.65rem; }
  .nav-header { padding:0 12px; }
  .nav-header .logo a { font-size:18px; }
  .featured-article img { max-height:220px; }
  .modal-box { padding:1.3rem; }
  .topics-grid { grid-template-columns: 1fr; }
  .related-sources-grid { grid-template-columns: 1fr; }
  .article-full h1 { font-size:1.2rem; }
}

/* ── Relative Time ──────────────────────────────────────────────── */
[data-ts] {
  cursor: default;
  border-bottom: 1px dotted rgba(0,0,0,0.18);
  transition: color 0.15s;
}
[data-ts]:hover { color: var(--fond); }
