/*
Theme Name: eSevai News
Theme URI: https://example.com/esevai-news
Author: Your Studio
Author URI: https://example.com
Description: A professional, trustworthy theme for e-Sevai style citizen-service and informative news portals. Built for news articles, how-to guides, and public service listings. Fully responsive.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: esevai-news
Tags: news, blog, government, accessibility-ready, custom-colors, custom-menu, featured-images, responsive-layout, translation-ready
*/

/* =========================================================
   1. DESIGN TOKENS
   ========================================================= */
:root {
  /* Color */
  --color-primary: #0B3D6E;      /* civic blue */
  --color-primary-dark: #082A4D;
  --color-accent: #C9862B;       /* warm gold - CTAs */
  --color-accent-dark: #A6691A;
  --color-success: #1E7D4B;      /* verified / status */
  --color-bg: #F7F8FA;
  --color-surface: #FFFFFF;
  --color-ink: #1A1F26;
  --color-ink-muted: #5B6470;
  --color-border: #DCE1E6;

  /* Type */
  /* Noto Sans Tamil is listed as a fallback so Tamil script picks up a
     matching weight/style instead of silently dropping to the browser's
     default serif. Space Grotesk / Source Sans 3 have no Tamil glyphs,
     so the browser skips them for Tamil characters and lands on the
     next font in the stack automatically - no extra markup needed. */
  --font-display: "Space Grotesk", "Noto Sans Tamil", "Segoe UI", sans-serif;
  --font-body: "Source Sans 3", "Noto Sans Tamil", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "Noto Sans Tamil", monospace;

  --fs-h1: clamp(1.9rem, 1.5rem + 1.8vw, 3rem);
  --fs-h2: clamp(1.5rem, 1.3rem + 1vw, 2.1rem);
  --fs-h3: clamp(1.15rem, 1.05rem + 0.5vw, 1.5rem);
  --fs-body: 1.0625rem;
  --fs-small: 0.875rem;

  --radius: 6px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --container: 1160px;
}

/* =========================================================
   2. RESET & BASE
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--color-ink);
  background: var(--color-bg);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-accent-dark); text-decoration: underline; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--color-primary-dark);
  line-height: 1.2;
  margin: 0 0 0.5em;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
p { margin: 0 0 1.2em; }
:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--color-primary); color: #fff;
  padding: 10px 16px; z-index: 999;
}
.skip-link:focus { left: 10px; top: 10px; }

/* =========================================================
   3. UTILITY BAR + HEADER
   ========================================================= */
.utility-bar {
  background: var(--color-primary-dark);
  color: #dce7f2;
  font-size: var(--fs-small);
}
.utility-bar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 6px;
  padding-bottom: 6px;
  gap: 16px;
  flex-wrap: wrap;
}
.utility-bar a { color: #dce7f2; }
.utility-bar ul { list-style: none; display: flex; gap: 18px; margin: 0; padding: 0; }
.utility-bar .updated-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
}
.utility-bar .updated-badge::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: #4ADE80; display: inline-block;
}

.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky; top: 0; z-index: 50;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
  gap: 24px;
}
.site-branding { display: flex; align-items: center; gap: 12px; }
.site-branding .logo-mark {
  width: 40px; height: 40px; border-radius: 8px;
  background: var(--color-primary);
  color: #fff; font-family: var(--font-display); font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.site-title { font-family: var(--font-display); font-size: 1.35rem; margin: 0; }
.site-title a { color: var(--color-ink); }
.site-description { font-size: var(--fs-small); color: var(--color-ink-muted); margin: 0; }

.primary-nav ul {
  list-style: none; display: flex; gap: 28px; margin: 0; padding: 0;
}
.primary-nav a {
  color: var(--color-ink);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 8px 2px;
  border-bottom: 2px solid transparent;
}
.primary-nav a:hover,
.primary-nav .current-menu-item > a {
  color: var(--color-primary);
  border-bottom-color: var(--color-accent);
  text-decoration: none;
}
.menu-toggle {
  display: none;
  background: none; border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: 8px 12px; cursor: pointer;
}

/* =========================================================
   4. CARDS / ARTICLE GRID
   ========================================================= */
.section-heading {
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 3px solid var(--color-primary);
  margin: 40px 0 20px;
  padding-bottom: 8px;
}
.section-heading h2 { margin: 0; }
.section-heading .view-all { font-size: var(--fs-small); font-weight: 600; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.post-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column;
}
.post-card .thumb { aspect-ratio: 16/10; overflow: hidden; background: var(--color-border); }
.post-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-card .card-body { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.post-card .category-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--color-accent-dark);
  background: #FBF0DD;
  width: fit-content; padding: 3px 8px; border-radius: 4px;
}
.post-card .category-tag.type-guide { color: var(--color-success); background: #E4F5EB; }
.post-card h3 { font-size: 1.1rem; margin: 4px 0; }
.post-card h3 a { color: var(--color-ink); }
.post-card .excerpt { color: var(--color-ink-muted); font-size: 0.95rem; margin: 0; }
.post-card .meta { margin-top: auto; font-size: var(--fs-small); color: var(--color-ink-muted); display: flex; gap: 10px; }

/* Featured / hero story */
.hero-story {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 24px;
  box-shadow: var(--shadow-card);
}
.hero-story .thumb { overflow: hidden; }
.hero-story .thumb img { width: 100%; height: 100%; object-fit: cover; }
.hero-story .content { padding: 28px 28px 28px 0; display: flex; flex-direction: column; justify-content: center; }
.hero-story h1 { margin-bottom: 12px; }

/* No featured image set on the hero post: collapse to a single column
   so the headline doesn't stretch full-width at hero type size. */
.hero-story.no-thumb { grid-template-columns: 1fr; }
.hero-story.no-thumb .content { padding: 32px; }
.hero-story.no-thumb h1 { font-size: var(--fs-h2); }

/* =========================================================
   5. SINGLE ARTICLE
   ========================================================= */
.entry-layout {
  display: grid;
  grid-template-columns: 2.2fr 1fr;
  gap: 40px;
  margin: 32px 0 60px;
  align-items: start;
}
.entry-header .category-tag { margin-bottom: 12px; }
.entry-meta {
  display: flex; gap: 16px; flex-wrap: wrap;
  font-size: var(--fs-small); color: var(--color-ink-muted);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 16px; margin-bottom: 24px;
}
.entry-meta .author { font-weight: 600; color: var(--color-ink); }
.entry-content { font-size: 1.06rem; }
.entry-content h2 { margin-top: 1.6em; }
.entry-content h3 { margin-top: 1.4em; }
.entry-content img { border-radius: var(--radius); margin: 20px 0; }
.entry-content blockquote {
  border-left: 4px solid var(--color-accent);
  margin: 24px 0; padding: 4px 20px;
  color: var(--color-ink-muted); font-style: italic;
}
.entry-content table { width: 100%; border-collapse: collapse; margin: 20px 0; }
.entry-content th, .entry-content td { border: 1px solid var(--color-border); padding: 10px 12px; text-align: left; }
.entry-content th { background: #EFF3F7; }

.trust-strip {
  display: flex; gap: 20px; flex-wrap: wrap;
  background: #EFF6FF; border: 1px solid #CFE2F5;
  border-radius: var(--radius); padding: 14px 18px;
  font-size: var(--fs-small); color: var(--color-primary-dark);
  margin-bottom: 24px;
}
.trust-strip span { display: flex; align-items: center; gap: 6px; font-weight: 600; }

/* Sidebar */
.sidebar .widget {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 24px;
}
.sidebar .widget h3 {
  font-size: 1rem; text-transform: uppercase; letter-spacing: 0.03em;
  border-bottom: 2px solid var(--color-accent); padding-bottom: 8px;
}
.sidebar .widget ul { list-style: none; margin: 0; padding: 0; }
.sidebar .widget li { padding: 8px 0; border-bottom: 1px dashed var(--color-border); font-size: 0.93rem; }
.sidebar .widget li:last-child { border-bottom: none; }

/* =========================================================
   6. HOW-TO GUIDE TEMPLATE
   ========================================================= */
.guide-summary {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--color-border);
  border: 1px solid var(--color-border);
  border-radius: var(--radius); overflow: hidden;
  margin: 20px 0 32px;
}
.guide-summary .stat {
  background: var(--color-surface); padding: 16px; text-align: center;
}
.guide-summary .stat .label { font-size: 0.72rem; text-transform: uppercase; color: var(--color-ink-muted); letter-spacing: 0.03em; }
.guide-summary .stat .value { font-family: var(--font-display); font-size: 1.15rem; color: var(--color-primary); margin-top: 4px; }

/* Steps are authored as H3 headings inside the guide editor content.
   Each H3 becomes a numbered marker; everything until the next H3 is its body. */
.guide-steps-wrapper { counter-reset: step; }
.guide-steps-wrapper h3 {
  counter-increment: step;
  position: relative;
  margin: 0 0 14px;
  padding: 0 0 0 56px;
  min-height: 40px;
  display: flex;
  align-items: center;
}
.guide-steps-wrapper h3::before {
  content: counter(step);
  font-family: var(--font-mono); font-weight: 700; font-size: 1rem;
  position: absolute; left: 0; top: 0;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--color-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.guide-steps-wrapper > *:not(h3) { margin-left: 56px; padding-left: 20px; border-left: 2px solid var(--color-border); }
.guide-steps-wrapper h3 ~ h3 { margin-top: 28px; }
.guide-steps-wrapper .step-note,
.entry-content .step-note {
  background: #FBF0DD; border: 1px solid #F0DBAF;
  border-radius: var(--radius); padding: 10px 14px;
  font-size: var(--fs-small); margin-top: 10px;
}

.documents-needed { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 20px; margin: 28px 0; }
.documents-needed ul { margin: 10px 0 0; padding-left: 20px; }

/* =========================================================
   7. FOOTER
   ========================================================= */
.site-footer {
  background: var(--color-primary-dark);
  color: #C9D6E4;
  margin-top: 60px;
}
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px;
  padding: 48px 0 28px;
}
.site-footer h4 { color: #fff; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.03em; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 8px; }
.site-footer a { color: #C9D6E4; }
.site-footer a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.12);
  padding: 16px 0; font-size: var(--fs-small);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}

/* =========================================================
   8. RESPONSIVE
   ========================================================= */
@media (max-width: 960px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .entry-layout { grid-template-columns: 1fr; }
  .hero-story { grid-template-columns: 1fr; }
  .hero-story .content { padding: 20px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .guide-summary { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 680px) {
  .primary-nav { position: fixed; inset: 0 0 0 30%; background: #fff; transform: translateX(100%); transition: transform .25s ease; padding: 90px 24px; box-shadow: -8px 0 24px rgba(0,0,0,0.15); }
  .primary-nav.is-open { transform: translateX(0); }
  .primary-nav ul { flex-direction: column; gap: 4px; }
  .menu-toggle { display: block; }
  .card-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; padding: 32px 0 16px; }
  .utility-bar ul { gap: 10px; }
  .site-header .container { flex-wrap: wrap; }
}
