/**
 * COMMON CSS — VoteForDMK-inspired theme
 * Font: Mukta Malar | Background: #fef3f3
 */
:root {
  --bg: #fef3f3;
  --bg-alt: #fff7f7;
  --surface: #ffffff;
  --surface-2: #fff0f0;
  --blue: #1a1a1a;
  --blue-deep: #111111;
  --blue-soft: #ffe8e8;
  --red: #c62828;
  --red-deep: #9b1c1c;
  --maroon: #6d1b2b;
  --navy: #1a1a1a;
  --navy-deep: #0d0d0d;
  --ink: #111111;
  --text: #1a1a1a;
  --text-muted: #5c5c5c;
  --border: #f0d5d5;
  --ok: #1f8a4c;
  --radius: 999px;
  --radius-card: 18px;
  --shadow: 0 10px 30px rgba(120, 30, 40, 0.08);
}

[data-theme="dark"] {
  --bg: #1a1214;
  --bg-alt: #22181a;
  --surface: #2a1e21;
  --surface-2: #342428;
  --text: #f5ecec;
  --text-muted: #c9b4b4;
  --border: #4a3338;
  --blue-soft: #3a2428;
  --navy: #f5ecec;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); }
body {
  font-family: "Mukta Malar", sans-serif;
  background-color: #fef3f3;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}
[data-theme="dark"] body { background-color: var(--bg); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
::selection { background: var(--red); color: #fff; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.site { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
main { flex: 1; }

/* Floating header shell (VoteForDMK style) */
header.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: transparent;
  border: none;
  padding: 14px 0 8px;
}
.nav-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 25px;
  padding: 10px 16px 10px 12px;
  box-shadow: var(--shadow);
  flex-wrap: nowrap;
}
.brand {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}
.brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  flex: none;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand-name { display: none; }
.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }

.nav-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

nav.links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
}
nav.links a,
.drop > button.dropbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s, transform .15s;
}
nav.links a:hover,
.drop > button.dropbtn:hover {
  border-color: var(--red);
  color: var(--red);
  background: #fff5f5;
}
nav.links a.active {
  background: var(--maroon);
  border-color: var(--maroon);
  color: #fff;
}
nav.links a.cta-join {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
nav.links a.cta-join:hover {
  background: var(--red-deep);
  border-color: var(--red-deep);
  color: #fff;
}

.drop { position: relative; }
.drop-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 8px;
  min-width: 220px;
  box-shadow: var(--shadow);
  display: none;
  grid-template-columns: 1fr;
  gap: 2px;
  z-index: 60;
}
.drop.open .drop-panel { display: grid; }
.drop-panel a {
  border-radius: 10px !important;
  border: none !important;
  justify-content: flex-start !important;
  background: transparent !important;
  color: var(--text) !important;
}
.drop-panel a:hover {
  background: var(--surface-2) !important;
  color: var(--red) !important;
}

.theme-toggle {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 16px;
  flex: none;
}
.theme-toggle:hover { border-color: var(--red); }
.navburger {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
}

.search-form { display: none; }

/* Flash */
.flash { padding: 12px 0; font-weight: 600; font-size: 14px; }
.flash-success { background: #e9f8ee; color: var(--ok); }
.flash-error, .flash-warning { background: #fdeceb; color: var(--red-deep); }

/* Buttons & sections */
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 15px;
  border: 1px solid transparent;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-deep); }
.btn-outline {
  border-color: var(--border);
  color: var(--text);
  background: #fff;
}
.btn-outline:hover { border-color: var(--red); color: var(--red); }
.btn-sm { padding: 8px 16px; font-size: 13.5px; }

section { padding: 48px 0; }
section.alt {
  background: transparent;
  border: none;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.section-head h2 {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 4px;
  color: var(--navy);
}
.section-head p { color: var(--text-muted); margin: 0; font-size: 15px; }
.tag {
  color: var(--red);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .04em;
}

/* Category cards */
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.cat-card {
  background: #fff;
  border-radius: var(--radius-card);
  padding: 32px 24px 28px;
  text-align: center;
  color: var(--navy);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.cat-icon { width: 52px; height: 52px; margin: 0 auto 16px; color: var(--red); }
.cat-icon svg { width: 100%; height: 100%; }
.cat-card h3 { font-size: 22px; font-weight: 800; margin: 0 0 10px; }
.cat-divider { width: 48px; height: 3px; background: var(--red); margin: 0 auto 14px; border-radius: 2px; }
.cat-card p { font-size: 14px; color: var(--text-muted); margin: 0 0 20px; line-height: 1.55; }
.cat-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--red);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 999px;
}
.cat-btn:hover { background: var(--red-deep); }
.cat-btn svg { width: 15px; height: 15px; }

/* Post cards */
.blog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.post-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.post-card-link { display: flex; flex-direction: column; height: 100%; }
.post-card .cover { aspect-ratio: 16/9; background: var(--surface-2) center/cover no-repeat; position: relative; }
.post-card .cover.empty::after {
  content: "செய்தி";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--red); font-weight: 800; font-size: 13px;
}
.badge-breaking {
  position: absolute; top: 10px; left: 10px;
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 800;
  padding: 4px 10px; border-radius: 999px;
}
.post-card .body { padding: 16px 18px 20px; flex: 1; display: flex; flex-direction: column; }
.post-card .date { font-size: 12px; color: var(--red); font-weight: 700; }
.post-card h3 { font-size: 17px; margin: 8px 0; font-weight: 800; line-height: 1.35; color: var(--navy); }
.post-card p { color: var(--text-muted); font-size: 13.5px; flex: 1; margin: 0 0 14px; }
.post-card .readmore { font-size: 13px; font-weight: 800; color: var(--red); }

.pagination-wrap { margin-top: 32px; }
.pagination ul { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.pagination .page-item a {
  display: block; padding: 8px 14px;
  border: 1px solid var(--border); border-radius: 999px;
  font-weight: 700; font-size: 14px; background: #fff;
}
.pagination .page-item.active a { background: var(--red); border-color: var(--red); color: #fff; }
.empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius-card);
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted);
  background: #fff;
}
.empty-state b { display: block; color: var(--navy); font-size: 16px; margin-bottom: 6px; }

/* Footer */
footer {
  background: #1a1214;
  border-top: 4px solid var(--red);
  padding: 44px 0 24px;
  color: #e8d5d5;
  font-size: 14px;
  margin-top: auto;
}
footer .fgrid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 28px;
  margin-bottom: 30px;
}
footer h4 {
  color: #fff;
  font-size: 14px;
  letter-spacing: .04em;
  margin: 0 0 14px;
}
footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
footer a:hover { color: #ffb4b4; }
.fbottom {
  border-top: 1px solid rgba(255,255,255,.12);
  padding-top: 18px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.footer-logo {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: #fff;
  overflow: hidden;
  margin-bottom: 14px;
}
.footer-logo img { width: 100%; height: 100%; object-fit: contain; }
.social-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.social-links a { color: #fff; font-weight: 700; font-size: 13px; }
.newsletter-form { display: flex; flex-direction: column; gap: 10px; }
.newsletter-form input {
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.08);
  color: #fff;
  padding: 10px 14px;
  border-radius: 999px;
}
.newsletter-form input::placeholder { color: rgba(255,255,255,.5); }

.popup-overlay {
  position: fixed; inset: 0;
  background: rgba(20, 8, 10, .55);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.popup-overlay[hidden] { display: none; }
.popup-modal {
  background: var(--surface);
  border-radius: 18px;
  padding: 28px;
  max-width: 480px;
  width: 100%;
  position: relative;
  border-top: 4px solid var(--red);
  box-shadow: 0 24px 60px rgba(0,0,0,.25);
}
.popup-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; font-size: 24px; color: var(--text-muted);
}
.popup-modal h3 { margin: 0 0 12px; color: var(--navy); font-size: 20px; }
.popup-body { color: var(--text-muted); margin-bottom: 16px; line-height: 1.6; }
.form-msg { font-size: 13.5px; padding: 11px 13px; border-radius: 10px; margin-top: 14px; }
.form-msg.ok { background: #e9f8ee; color: var(--ok); border: 1px solid #b9e8c8; }
.form-msg.err { background: #fdeceb; color: var(--red-deep); border: 1px solid #f5c0be; }

@media (max-width: 980px) {
  .nav-shell { border-radius: 22px; padding: 10px 12px; }
  .brand-mark { width: 56px; height: 56px; }
  nav.links {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 20px;
    right: 20px;
    background: var(--surface);
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    z-index: 60;
  }
  nav.links.open { display: flex; }
  nav.links a, .drop > button.dropbtn { width: 100%; justify-content: flex-start; }
  header.nav { position: sticky; }
  header.nav .wrap { position: relative; }
  .drop-panel { position: static; box-shadow: none; display: none; }
  .drop.open .drop-panel { display: grid; }
  .navburger { display: inline-flex; align-items: center; justify-content: center; }
  .blog-grid, .cat-grid { grid-template-columns: 1fr 1fr; }
  footer .fgrid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  section { padding: 36px 0; }
  .brand-mark { width: 52px; height: 52px; }
  .blog-grid, .cat-grid { grid-template-columns: 1fr; }
  footer .fgrid { grid-template-columns: 1fr; }
  .section-head h2 { font-size: 22px; }
}

@media print {
  header.nav, footer, .share-buttons, .popup-overlay, .flash { display: none !important; }
  body { color: #000; background: #fff; }
}
