/*
Theme Name: ePathram Sections
Theme URI: https://epathram.com/
Description: ePathram theme for section pages — Guardian-style look (v2.0). All loops and categories unchanged.
Version: 2.0
Author: Jishi Samuel
Author URI: http://jishisamuel.com/
Tags: four columns, widgets, responsive
*/

/* =====================================================================
   1. Design tokens
   ===================================================================== */
:root {
  --font-head: 'Noto Serif Malayalam', 'Malayalam Sangam MN', 'Nirmala UI', 'AnjaliOldLipi', Georgia, serif;
  --font-body: 'Manjari', 'Noto Sans Malayalam', 'Malayalam MN', 'Nirmala UI', 'Kartika', 'AnjaliOldLipi', sans-serif;

  --ink: #121212;
  --ink-soft: #545454;
  --rule: #dcdcdc;
  --navy: #052962;
  --navy-rule: #506991;
  --navy-soft: #c1d8fc;
  --highlight: #ffe500;
  --accent: #c70000;      /* news red: kickers, section names */
  --link: #052962;
  --wash: #f6f6f6;
}

/* =====================================================================
   2. Base
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
  background: #fff;
}
img { max-width: 100%; height: auto; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.35; color: var(--ink); }
hr { border: 0; border-top: 1px solid var(--rule); height: 0; margin: 16px 0; background: none; color: transparent; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ep-wrap { max-width: 1300px; margin: 0 auto; padding: 0 20px; }
img.wp-smiley { border: 0; }
.center { text-align: center; }

/* Old helper classes still used in content */
.contentlink, .contentlink:hover { border: 0; font-size: inherit; }
.contenttext { color: var(--ink-soft); font-size: 0.98rem; }
.englishtext, .englishlink { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 0.8em; color: var(--ink-soft); }
.epdate { font-size: inherit; font-family: inherit; }
.boxtable { border: 1px solid var(--rule); }

/* =====================================================================
   3. Ads band (top) and ad slots
   ===================================================================== */
#adband { background: var(--wash); border-bottom: 1px solid var(--rule); }
.adband-inner { display: flex; justify-content: center; align-items: center; gap: 12px; padding-top: 8px; padding-bottom: 8px; flex-wrap: wrap; }
.ad-slot { max-width: 100%; overflow-x: auto; text-align: center; }
.ad-slot img { display: inline-block; vertical-align: middle; }
.ad-468 { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: center; }
.ad-728 { padding: 14px 0; border-bottom: 1px solid var(--rule); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ad-120, .ad-200 { margin: 16px 0; padding: 10px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }

/* =====================================================================
   4. Masthead
   ===================================================================== */
#header { background: var(--navy); color: #fff; width: auto; }
.masthead {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding-top: 16px;
  padding-bottom: 14px;
}
.masthead-left { display: flex; flex-direction: column; gap: 10px; }
.masthead-date { margin: 0; font-weight: 700; font-size: 0.95rem; color: #fff; }

.masthead-brand { text-align: right; }
.wordmark {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: clamp(2.6rem, 6.5vw, 4.8rem);
  line-height: 1;
  color: #fff;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.wordmark:hover { color: #fff; text-decoration: none; }
.masthead-tagline { margin: 6px 0 0; color: var(--navy-soft); font-size: 0.95rem; }

/* Google site search, restyled */
#search form { margin: 0; }
.search-row { display: flex; }
#sbi {
  width: 220px; max-width: 60vw;
  padding: 7px 10px;
  border: 0; border-radius: 3px 0 0 3px;
  font: inherit; font-size: 0.95rem;
}
#sbb {
  padding: 7px 14px;
  border: 0; border-radius: 0 3px 3px 0;
  background: var(--highlight); color: var(--ink);
  font: 700 0.95rem var(--font-body);
  cursor: pointer;
}
.search-scope { font-size: 0.85rem; color: var(--navy-soft); margin-top: 4px; }
.search-scope label { margin-right: 10px; cursor: pointer; }
.search-scope input { vertical-align: middle; margin: 0 3px 0 0; }

/* Navigation: two rows, same links as before */
#navmenu { border-top: 1px solid var(--navy-rule); width: auto; margin: 0; }
.nav-primary, .nav-secondary { display: flex; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.nav-primary li { border-right: 1px solid var(--navy-rule); }
.nav-primary li:first-child a { padding-left: 0; }
.nav-primary a {
  display: block;
  padding: 8px 18px 10px;
  font: 700 1.1rem var(--font-head);
  color: #fff;
  border-top: 4px solid transparent;
  margin-top: -1px;
}
.nav-primary a:hover { color: #fff; text-decoration: none; border-top-color: var(--highlight); }

.nav-secondary-bar { background: #fff; border-bottom: 1px solid var(--rule); }
.nav-secondary li a {
  display: block;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
}
.nav-secondary li:first-child a { padding-left: 0; }
.nav-secondary li a:hover { color: var(--accent); text-decoration: none; }

/* Ticker */
#tickerrow {
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--rule);
  padding: 6px 0;
  width: auto; margin: 0;
}
.ticker-label {
  flex: none;
  background: var(--accent); color: #fff;
  font-weight: 700; font-size: 0.85rem;
  padding: 1px 10px;
}
#tickerrow iframe { flex: 1; width: 100%; min-width: 0; height: 25px; border: 0; }

/* Section name (the blog you are on: Kerala, World…) */
.section-banner { padding: 10px 0 2px; }
.section-name { margin: 0; font: 800 1.8rem/1.2 var(--font-head); }
.section-name a { color: var(--accent); }
.section-name a:hover { text-decoration: none; }

/* =====================================================================
   5. Four-column layout (col1 main, col2 rail, col3 + col4 narrow rails)
   ===================================================================== */
#mid {
  max-width: 1300px;
  width: auto;
  margin: 0 auto;
  padding: 10px 20px 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px 160px 160px;
  overflow: visible;
}
#mid.mid-search { grid-template-columns: minmax(0, 1fr) 300px; }
#col1, #col2, #col3, #col4,
#col1cont, #col2cont, #col3cont, #col4cont {
  float: none; width: auto; margin: 0; background: transparent; border: 0; overflow: visible;
}
#col1 { padding-right: 24px; min-width: 0; }
#col2, #col3, #col4 { border-left: 1px solid var(--rule); padding: 0 12px; min-width: 0; }
#col4 { padding-right: 0; }

/* Rail headings (Guardian-style: heavy top rule, bold serif) */
.ep-rail-title, #sidebar h4, #col3 h4, #col4 h4 {
  margin: 0 0 8px;
  padding-top: 6px;
  border-top: 3px solid var(--ink);
  font: 800 1.05rem var(--font-head);
}
#sidebar h4 { margin-top: 18px; }
#sidebar > h4:first-child, #sidebar > .ep-rail-title:first-child { margin-top: 0; }

/* =====================================================================
   6. Story lists (index, category, search)
   ===================================================================== */
.ep-archive-title {
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
  font-size: 2rem; font-weight: 800; color: var(--accent);
}
.ep-story {
  border-top: 1px solid var(--accent);
  padding: 8px 0 22px;
  margin: 0 0 6px;
}
.ep-story-title { margin: 0 0 6px; font-size: 1.55rem; font-weight: 800; line-height: 1.3; }
.ep-story-title a { color: var(--ink); }
.ep-story-title a:hover { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.ep-story-compact .ep-story-title { font-size: 1.2rem; }

.ep-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 10px; font-size: 0.85rem; color: var(--ink-soft); }
.ep-byline { font-weight: 700; color: var(--accent); }
.ep-tags { font-size: 0.9rem; color: var(--ink-soft); margin: 10px 0 0; }
.ep-tags a { font-weight: 700; }
.ep-comments-link { margin: 6px 0 0; font-size: 0.9rem; font-weight: 700; }

/* Paging */
.ep-pagenavi { margin: 20px 0 10px; }
.wp-pagenavi { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wp-pagenavi a, .wp-pagenavi span {
  padding: 4px 11px; border: 1px solid var(--rule); color: var(--ink); text-decoration: none; font-size: 0.9rem;
}
.wp-pagenavi a:hover { border-color: var(--navy); color: var(--navy); }
.wp-pagenavi span.current { background: var(--navy); color: #fff; border-color: var(--navy); }
.wp-pagenavi span.pages, .wp-pagenavi span.extend { border: 0; color: var(--ink-soft); }
.ep-postnav { display: flex; justify-content: space-between; gap: 14px; margin: 14px 0; font-weight: 700; font-size: 0.95rem; }
.ep-postnav-single { display: block; border-top: 1px solid var(--rule); padding-top: 10px; }
.navigation { display: flex; justify-content: space-between; margin: 12px 0 20px; font-weight: 700; }

/* =====================================================================
   7. Article page (single.php, page.php)
   ===================================================================== */
.ep-article { padding-top: 4px; }
.ep-article-title { margin: 0 0 12px; font-size: clamp(1.8rem, 3.4vw, 2.6rem); font-weight: 800; line-height: 1.25; }
.ep-article-meta {
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  padding: 8px 0; margin-bottom: 18px;
}
.ep-sentby { font-style: italic; }

.entry { font-size: 1.08rem; line-height: 1.85; overflow-wrap: break-word; }
.ep-article .entry { font-size: 1.12rem; max-width: 720px; }
.entry p { margin: 0 0 1.05em; }
.entry a { color: var(--navy); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
.entry a:hover { color: var(--accent); text-decoration-color: currentColor; }
.entry img { border: 0; margin: 0.4em 0 0.8em; }
.entry blockquote { margin: 1.2em 0; padding: 0 0 0 16px; border-left: 4px solid var(--accent); font-family: var(--font-head); font-size: 1.15em; color: var(--ink); }
.entry ul { padding-left: 1.3em; list-style: square; }
.entry ul li::before { content: none; }
.entry ol { padding-left: 1.5em; }
.entry li { margin: 0.3em 0; }
.entry h2, .entry h3 { margin: 1.3em 0 0.5em; }
.entry iframe, .entry video, .entry object, .entry embed { max-width: 100%; }

/* Related posts plugin */
.ep-related { margin-top: 26px; border-top: 3px solid var(--ink); padding-top: 6px; }
.ep-related h3, .ep-related h2 { font-size: 1.1rem; font-weight: 800; margin: 0 0 6px; }
.ep-related ul { list-style: none; margin: 0; padding: 0; }
.ep-related li { padding: 7px 0; border-bottom: 1px solid var(--rule); font: 700 1rem/1.45 var(--font-head); }
.ep-related li a { color: var(--ink); }

/* Images and captions */
.alignright { float: right; margin: 0.3em 0 0.8em 1.2em; }
.alignleft { float: left; margin: 0.3em 1.2em 0.8em 0; }
.aligncenter, div.aligncenter, img.centered { display: block; margin-left: auto; margin-right: auto; }
img.alignright, img.alignleft, img.aligncenter, img.centered { border: 0; }
.wp-caption { max-width: 100%; border: 0; background: none; padding: 0; margin: 0.5em 0 1em; text-align: left; border-radius: 0; }
.wp-caption.alignright, .wp-caption.alignleft { max-width: 50%; }
.wp-caption img { margin: 0; display: block; }
.wp-caption p.wp-caption-text { font-size: 0.85rem; line-height: 1.5; color: var(--ink-soft); padding: 6px 0 0; margin: 0; }

/* =====================================================================
   8. Comments
   ===================================================================== */
.ep-comments { margin-top: 30px; clear: both; }
#comments, #respond h4 { border-top: 3px solid var(--ink); padding-top: 6px; font: 800 1.15rem var(--font-head); }
.commentlist { list-style: none; padding: 0; margin: 0; text-align: left; }
.commentlist li { margin: 0; padding: 12px 0; border-bottom: 1px solid var(--rule); font: inherit; font-weight: 400; }
.commentlist li .avatar { float: right; border: 0; padding: 0; border-radius: 50%; }
.commentlist cite, .commentlist cite a { font-weight: 700; font-style: normal; color: var(--ink); }
.commentlist p { margin: 6px 0; line-height: 1.6; }
.commentmetadata, .comment-meta { font-size: 0.8rem; color: var(--ink-soft); display: block; }
.commentlist .children { list-style: none; padding-left: 20px; border-left: 2px solid var(--rule); }
#commentform p { margin: 8px 0; font-family: inherit; }
#commentform input[type="text"] { width: 280px; max-width: 100%; padding: 7px 9px; border: 1px solid #999; font: inherit; margin: 0 6px 0 0; }
#commentform textarea, #comment {
  width: 100%; padding: 10px;
  border: 1px solid #999;
  font: 1.05rem/1.6 var(--font-body);
  color: var(--ink);
}
#commentform #submit {
  float: none; width: auto;
  padding: 9px 18px; border: 0; border-radius: 3px;
  background: var(--navy); color: #fff;
  font: 700 1rem var(--font-body); cursor: pointer;
}
#commentform #submit:hover { background: #041f4a; }
.nocomments { color: var(--ink-soft); text-align: left; }

/* =====================================================================
   9. Rails (col2 sidebar, col3, col4)
   ===================================================================== */
#sidebar ul, #sidebar ol { margin: 0; padding: 0; list-style: none; }
#sidebar ul li { margin: 0; }

/* "Latest" list from wp_get_archives */
.ep-latest ul { list-style: none; margin: 0; padding: 0; }
.ep-latest li, #sidebar .ep-latest li {
  margin: 0; padding: 7px 0;
  border-bottom: 1px solid var(--rule);
  text-indent: 0;
  font: 700 0.95rem/1.45 var(--font-head);
}
.ep-latest li { list-style: none; }
.ep-latest li::before { content: none !important; }
.ep-latest a { color: var(--ink); text-decoration: none; }
.ep-latest a:hover { color: var(--accent); }
.ep-archive-select { margin: 14px 0; }
.ep-archive-select select { width: 100%; padding: 6px; font: inherit; font-size: 0.9rem; }

/* Featured list (newsbar.php) */
.ep-feature { border-top: 1px solid var(--accent); padding: 6px 0 14px; }
.ep-feature-media img { display: block; width: 100%; height: auto; border: 0; margin-bottom: 6px; }
.ep-feature-title { margin: 0 0 4px; font-size: 1.05rem; font-weight: 800; line-height: 1.35; }
.ep-feature-title a { color: var(--ink); }
.ep-feature .contenttext { font-size: 0.92rem; line-height: 1.6; }
.ep-more { font-weight: 700; white-space: nowrap; }

/* Narrow rail boxes */
.ep-box { margin: 0 0 12px; }
.ep-box img { display: block; border: 0; }
.ep-center { text-align: center; }
.ep-center img { margin: 0 auto 6px; }
.ep-goldrate iframe { display: block; border: 0; max-width: 100%; }
.ep-green { background: var(--wash); padding: 6px; }

/* Picture stories (thumb-story / fun-story) */
.ep-thumb { margin: 0 0 12px; border-top: 1px solid var(--accent); padding-top: 5px; }
.ep-thumb a { display: block; color: var(--ink); }
.ep-thumb img { display: block; width: 100%; height: auto; border: 0; }
.ep-thumb-title { display: block; padding: 4px 0 0; font: 700 0.88rem/1.4 var(--font-head); }
.ep-thumb a:hover .ep-thumb-title { text-decoration: underline; }

/* Tag cloud */
#tagcontainer { width: auto; }
#tagcontainer ul { margin: 0; padding: 0; list-style: none; font-family: inherit; display: flex; flex-wrap: wrap; gap: 5px; }
#tagcontainer li { margin: 0; }
#tagcontainer a, #tagcontainer a:link, #taglist a:visited {
  display: inline-block; width: auto;
  padding: 2px 8px;
  background: var(--wash); border: 1px solid var(--rule); border-radius: 12px;
  color: var(--ink); font-size: 0.82rem !important; text-decoration: none;
}
#tagcontainer a:hover { background: var(--navy); color: #fff; border-color: var(--navy); }

/* =====================================================================
   10. Footer
   ===================================================================== */
#footer { clear: both; width: auto; height: auto; background: var(--navy); color: #fff; margin-top: 30px; padding: 28px 0 18px; }
.footer-brand-row { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--navy-rule); }
.footer-wordmark { font-size: 2.4rem; }
.footer-links-inline { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer-links-inline a { color: #fff; font-weight: 700; font-size: 0.95rem; }
.footer-columns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; padding: 20px 0; }
.footer-col { border-left: 1px solid var(--navy-rule); padding-left: 14px; }
.footer-col h3 { margin: 0 0 6px; font-size: 1rem; font-weight: 800; color: var(--highlight); }
.footer-col h3 + ul + h3 { margin-top: 16px; }
.footer-col ul { list-style: none; margin: 0 0 14px; padding: 0; }
.footer-col li { margin: 0 0 4px; }
.footer-col a { color: #fff; font-size: 0.95rem; }
.footer-col a:hover { color: #fff; text-decoration: underline; }
.footer-col .englishlink { color: var(--navy-soft); font-size: 0.85rem; }
.footer-copy { margin: 0; padding-top: 12px; border-top: 1px solid var(--navy-rule); font-size: 0.85rem; color: var(--navy-soft); }
.statcounter { display: none; }

/* =====================================================================
   11. Responsive
   ===================================================================== */
@media (max-width: 1180px) {
  /* narrow rails move below the main column + sidebar */
  #mid { grid-template-columns: minmax(0, 1fr) 300px; }
  #col3, #col4 { border-left: 0; border-top: 3px solid var(--ink); padding: 10px 0 0; margin-top: 24px; }
  #col3 { grid-column: 1; }
  #col4 { grid-column: 2; padding-left: 12px; }
  #col3cont .ep-thumb, #col3cont .ep-box { display: inline-block; vertical-align: top; width: calc(33.33% - 10px); margin-right: 8px; }
}
@media (max-width: 860px) {
  #mid, #mid.mid-search { grid-template-columns: 1fr; padding-left: 16px; padding-right: 16px; }
  #col1 { padding-right: 0; }
  #col2, #col3, #col4 { grid-column: 1; border-left: 0; padding: 10px 0 0; margin-top: 24px; border-top: 3px solid var(--ink); }
  #col3cont .ep-thumb, #col3cont .ep-box { width: calc(50% - 8px); }
  .footer-columns { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .ep-wrap { padding: 0 16px; }
  .masthead { flex-direction: column-reverse; align-items: stretch; gap: 12px; }
  .masthead-brand { text-align: left; }
  #sbi { width: 100%; max-width: none; flex: 1; }
  .nav-primary, .nav-secondary { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .nav-primary a { white-space: nowrap; padding: 6px 12px 8px; font-size: 1rem; }
  .nav-secondary li a { white-space: nowrap; }
  .ep-story-title { font-size: 1.3rem; }
  .alignright, .alignleft, .wp-caption.alignright, .wp-caption.alignleft { float: none; margin: 0.5em 0; max-width: 100%; }
  .footer-columns { grid-template-columns: 1fr; }
}

/* On category archives the category heading already names the section */
body.category .section-banner { display: none; }

/* The old "titleimagebar" widget (title GIF + coloured bar, 985px wide) is replaced by the section name banner */
.ep-titleimagebar { display: none; }

/* Old child-theme sidebars (e.g. epnews): bare <li> lists and image menus inside col2 */
#col2 .entry > li,
#col2 .entry > ul > li {
  list-style: none;
  margin: 0; padding: 7px 0;
  border-bottom: 1px solid var(--rule);
  text-indent: 0;
  font: 700 0.95rem/1.45 var(--font-head);
}
#col2 .entry > li::before, #col2 .entry > ul > li::before { content: none; }
#col2 .entry > ul { margin: 0; padding: 0; }
#col2 .entry a { color: var(--ink); text-decoration: none; }
#col2 .entry a:hover { color: var(--accent); }
#col2 .menutop, #col2cont > div[align="center"] > div { width: auto !important; }
#col2cont > div[align="center"] img { display: inline-block; max-width: 100%; }
#col2cont hr { margin: 8px 0; }
