@font-face {
  font-family: 'MV Typewriter';
  src: url("https://dhivehi.mv/fonts/data/df/mvtyper.ttf");
}

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

:root {
  --primary:       #1a2744;   /* deep navy */
  --primary-dark:  #0d1628;   /* midnight navy */
  --primary-light: #253660;   /* mid navy */
  --accent:        #ff6b35;   /* vivid coral */
  --accent-dark:   #e0521c;
  --accent-light:  #ff8c5a;
  --bg:            #f2f5fb;   /* cool off-white */
  --bg-card:       #ffffff;
  --bg-subtle:     #eef1f8;
  --text:          #0f172a;
  --text-muted:    #5a6a85;
  --text-light:    #94a3b8;
  --border:        #dde3ef;
  --shadow:        0 2px 12px rgba(26,39,68,0.09);
  --shadow-hover:  0 8px 28px rgba(26,39,68,0.18);
  --radius:        9px;
  --radius-lg:     16px;
  --font:          'MV Typewriter', 'Faruma', 'A_Faruma', sans-serif;
  --transition:    0.2s ease;
}

/* ===== SKIP LINK (accessibility + SEO) ===== */
.skip-link {
  position: absolute;
  top: -100%;
  right: 0;
  background: var(--accent);
  color: #000;
  padding: 10px 18px;
  font-size: 14px;
  border-radius: 0 0 var(--radius) var(--radius);
  z-index: 9999;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  line-height: 1.7;
  font-size: 16px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

a {
  text-decoration: none;
  color: inherit;
}

ul { list-style: none; }

.hidden { display: none !important; }

/* ===== HEADER ===== */
.site-header {
  background: var(--primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
}

.header-top {
  background: var(--primary-dark);
  padding: 5px 0;
  font-size: 13px;
}

.header-top .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-date, .header-time {
  opacity: 0.85;
}

.header-main {
  padding: 14px 0;
  border-bottom: 2px solid var(--primary-light);
}

.logo h1 {
  font-size: 32px;
  font-weight: bold;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.logo .tagline {
  font-size: 13px;
  opacity: 0.8;
  display: block;
  margin-top: 2px;
}

.main-nav {
  background: var(--primary-dark);
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 0;
}

.nav-list li a {
  display: block;
  padding: 10px 16px;
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  transition: all var(--transition);
  border-bottom: 3px solid transparent;
}

.nav-list li a:hover,
.nav-list li a.active {
  color: #fff;
  background: rgba(255,255,255,0.08);
  border-bottom-color: var(--accent);
}

/* ===== TICKER ===== */
.ticker-bar {
  background: var(--accent);
  color: #1a1a1a;
  padding: 8px 0;
  overflow: hidden;
  font-size: 14px;
}

.ticker-bar .container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ticker-label {
  font-weight: bold;
  white-space: nowrap;
  background: #1a1a1a;
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
  flex-shrink: 0;
}

.ticker-wrapper {
  overflow: hidden;
  flex: 1;
}

.ticker-content {
  display: flex;
  white-space: nowrap;
  animation: ticker 60s linear infinite;
}

.ticker-content .ticker-item {
  margin-left: 60px;
}

.ticker-content .ticker-sep {
  margin: 0 16px;
  opacity: 0.5;
}

@keyframes ticker {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ===== MAIN ===== */
.main-content {
  padding: 24px 0 40px;
  min-height: 60vh;
}

.last-updated {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 20px;
}

/* ===== LOADING / ERROR ===== */
.loading-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.error-state button {
  margin-top: 14px;
  padding: 10px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  transition: background var(--transition);
}

.error-state button:hover { background: var(--primary-dark); }

/* ===== FEATURED GRID ===== */
.featured-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: auto auto;
  gap: 16px;
  margin-bottom: 32px;
}

.featured-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
  position: relative;
}

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

.featured-card.main {
  grid-row: span 2;
}

.featured-card .card-image {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  background: var(--border);
}

.featured-card.main .card-image {
  aspect-ratio: 4/3;
}

.featured-card .card-body {
  padding: 16px;
}

.featured-card.main .card-body {
  padding: 20px;
}

.featured-card .card-source {
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.featured-card .card-source .source-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  display: inline-block;
}

.featured-card h2, .featured-card h3 {
  font-size: 18px;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 8px;
}

.featured-card.main h2 {
  font-size: 22px;
}

.featured-card .card-excerpt {
  font-size: 14px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.featured-card .card-meta {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.featured-card .card-category-badge {
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
}

/* ===== SECTION HEADER ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary);
}

.section-header h2 {
  font-size: 20px;
  color: var(--primary);
}

.source-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.source-filter-btn {
  padding: 5px 14px;
  border: 2px solid var(--border);
  background: #fff;
  border-radius: 20px;
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-muted);
}

.source-filter-btn:hover,
.source-filter-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

/* ===== NEWS GRID ===== */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.news-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
}

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

.news-card .card-image {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.news-card .card-image-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.5);
  font-size: 36px;
}

.news-card .card-body {
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.news-card .card-source {
  font-size: 11px;
  font-weight: bold;
  color: var(--primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.news-card .source-logo {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  object-fit: contain;
}

.news-card h3 {
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 8px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-card .card-meta {
  font-size: 11px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.news-card .card-category {
  background: rgba(26, 107, 60, 0.1);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
}

.news-card .read-more {
  color: var(--primary);
  font-size: 12px;
  transition: color var(--transition);
}

.news-card:hover .read-more { color: var(--primary-dark); }

/* ===== LOAD MORE ===== */
.load-more-wrapper {
  text-align: center;
  margin-top: 30px;
}

.load-more-btn {
  padding: 12px 36px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 15px;
  cursor: pointer;
  transition: background var(--transition);
}

.load-more-btn:hover { background: var(--primary-dark); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}

.modal-content {
  background: #fff;
  border-radius: var(--radius-lg);
  max-width: 680px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.modal-close {
  position: sticky;
  top: 12px;
  float: left;
  background: var(--border);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  margin: 12px 12px 0 12px;
  z-index: 1;
}

.modal-close:hover { background: #ccc; }

.modal-body {
  padding: 24px;
  clear: both;
}

.modal-source-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  margin-bottom: 14px;
}

.modal-body h2 {
  font-size: 20px;
  line-height: 1.6;
  margin-bottom: 12px;
  color: var(--text);
}

.modal-body .modal-image {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 16px;
  object-fit: cover;
  max-height: 300px;
}

.modal-body .modal-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.modal-body .modal-excerpt {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 20px;
}

.modal-body .read-original-btn {
  display: inline-block;
  padding: 12px 28px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  font-size: 14px;
  transition: background var(--transition);
}

.modal-body .read-original-btn:hover { background: var(--primary-dark); }

.credit-note {
  margin-top: 16px;
  padding: 10px 14px;
  background: #f9f9f5;
  border-right: 3px solid var(--accent);
  font-size: 13px;
  color: var(--text-muted);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ===== FOOTER ===== */
.site-footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.85);
  padding: 40px 0 0;
  margin-top: 40px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  margin-bottom: 30px;
}

.footer-col h3 {
  font-size: 16px;
  margin-bottom: 14px;
  color: #fff;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-light);
}

.footer-col p {
  font-size: 13px;
  line-height: 1.8;
  opacity: 0.8;
}

.footer-col ul li {
  margin-bottom: 8px;
}

.footer-col ul li a {
  font-size: 13px;
  opacity: 0.8;
  transition: opacity var(--transition);
}

.footer-col ul li a:hover { opacity: 1; color: var(--accent); }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 16px 0;
  text-align: center;
  font-size: 12px;
  opacity: 0.7;
}

/* ===== BACK TO TOP ===== */
.back-to-top {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-hover);
  transition: background var(--transition), transform var(--transition);
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .logo h1 { font-size: 24px; }

  .featured-grid {
    grid-template-columns: 1fr;
  }

  .featured-card.main {
    grid-row: auto;
  }

  .nav-list li a {
    padding: 8px 10px;
    font-size: 13px;
  }

  .news-grid {
    grid-template-columns: 1fr;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .header-top { display: none; }
  .logo h1 { font-size: 20px; }
  .ticker-bar .container { gap: 6px; }
}

/* ===== SOURCE COLOR DOTS ===== */
.source-sunmv    { background: #ef4444 !important; }
.source-miadhu   { background: #3b82f6 !important; }
.source-vmtv     { background: #8b5cf6 !important; }
.source-mihaaru  { background: #f97316 !important; }
.source-raajje   { background: #06b6d4 !important; }
.source-avas     { background: #10b981 !important; }
.source-vaguthu  { background: #eab308 !important; }
.source-adhunews { background: #ec4899 !important; }

.source-color-sunmv    { color: #ef4444; }
.source-color-miadhu   { color: #3b82f6; }
.source-color-vmtv     { color: #8b5cf6; }
.source-color-mihaaru  { color: #f97316; }
.source-color-raajje   { color: #06b6d4; }
.source-color-avas     { color: #10b981; }
.source-color-vaguthu  { color: #eab308; }
.source-color-adhunews { color: #ec4899; }
