/*
Theme Name: Herald Online
Theme URI: https://www.heraldonline.co.zw/
Author: Herald Online Dev Team
Description: Mobile-first, BBC News-inspired custom theme for Herald Online and its publications (Herald, Chronicle, Sunday Mail, Sunday News, Manicapost, HMetro, BMetro, Kwayedza, Umthunywa).
Version: 1.0.0
Text Domain: herald-online
*/

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  --brand-red: #cf2e2e;
  --brand-grey: #ececec;
  --brand-blue: #1b80c2;
  --brand-green: #195f17;

  --c-bg: #ffffff;
  --c-bg-alt: #f4f4f4;
  --c-bg-dark: #141414;
  --c-text: #141414;
  --c-text-soft: #4a4a4a;
  --c-text-muted: #6e6e6e;
  --c-border: #e4e4e4;
  --c-border-strong: #c9c9c9;

  --c-accent: #cf2e2e;
  --c-link: #141414;
  --c-link-hover: #cf2e2e;
  --c-live: #cf2e2e;

  --maxw: 1280px;
  --gutter: 16px;
  --radius: 4px;
  --radius-lg: 8px;

  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;
  --fs-3xl: 2.25rem;
  --fs-4xl: 3rem;

  --lh-tight: 1.15;
  --lh-snug: 1.3;
  --lh-base: 1.55;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 2px 8px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);

  --t-fast: 140ms ease;
  --t-base: 220ms ease;
}

/* ============================================================
   RESET / BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, video, svg { max-width: 100%; height: auto; display: block; }

a { color: var(--c-link); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--c-link-hover); }

h1,h2,h3,h4,h5,h6 { margin: 0 0 .5em; line-height: var(--lh-tight); font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
p  { margin: 0 0 1em; }

button { font: inherit; cursor: pointer; }

/* Utility */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ============================================================
   HEADER (outer shell)
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  margin-top: 48px;
  background: var(--c-bg-dark);
  color: #d8d8d8;
  padding: 32px 0 16px;
  font-size: var(--fs-sm);
}
.site-footer a { color: #d8d8d8; }
.site-footer a:hover { color: #fff; }

/* ============================================================
   PUBLICATION THEME VARIABLES
   ============================================================ */
body.pub-herald      { --pub-color: #d02f29; }
body.pub-chronicle   { --pub-color: #1b80c2; }
body.pub-sundaymail  { --pub-color: #1b80c2; }
body.pub-sundaynews  { --pub-color: #195f17; }
body.pub-manicapost  { --pub-color: #1b80c2; }
body.pub-hmetro      { --pub-color: #d02f29; }
body.pub-bmetro      { --pub-color: #1b80c2; }
body.pub-kwayedza    { --pub-color: #d02f29; }
body.pub-umthunywa   { --pub-color: #1b80c2; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--c-bg);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--t-base);
}
.card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.card__body { padding: 10px 0 0; }
.card__title { font-size: var(--fs-md); font-weight: 700; line-height: var(--lh-snug); margin: 0 0 4px; }
.card__meta { font-size: var(--fs-xs); color: var(--c-text-muted); text-transform: uppercase; letter-spacing: .04em; }
.card:hover .card__title { color: var(--c-link-hover); }

/* ============================================================
   SECTION HEADING
   ============================================================ */
.section-head {
  display: flex; align-items: center; gap: 10px;
  margin: 32px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--c-text);
}
.section-head h2 {
  margin: 0; font-size: var(--fs-xl); font-weight: 800;
  text-transform: none;
}
.section-head::before {
  content: ""; display: inline-block;
  width: 6px; height: 20px; background: var(--c-accent);
}
.section-head .more { margin-left: auto; font-size: var(--fs-sm); font-weight: 600; color: var(--c-accent); }

/* ============================================================
   LIVE BADGE
   ============================================================ */
.live-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--c-live); color: #fff;
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  padding: 3px 7px; border-radius: 3px; text-transform: uppercase;
}
.live-badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff;
  animation: pulse 1.4s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .3 } }

/* ============================================================
   RESPONSIVE TYPE BUMPS
   ============================================================ */
@media (min-width: 768px) {
  h1 { font-size: 2.75rem; }
  h2 { font-size: 1.875rem; }
}
@media (min-width: 1024px) {
  :root { --gutter: 24px; }
  h1 { font-size: var(--fs-4xl); }
}

/* ============================================================
   HEADER — TOPBAR  (row 1)
   ============================================================ */
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 8px; top: 8px; z-index: 999; background: #000; color: #fff; padding: 8px 12px; border-radius: 4px; }

.topbar {
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
  position: relative;
  z-index: 20;
  overflow: hidden;           /* HARD LIMIT: nothing in the topbar can escape it */
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: 12px;
  overflow: hidden;           /* belt-and-braces: the inner flex row can't overflow either */
}

/* Brand container — for custom logo, this is a <div>; for text fallback, it's an <a> */
.brand {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: center;
  min-width: 0;
  max-height: 56px;           /* never taller than the topbar */
  overflow: hidden;
}
.brand__text {
  font-weight: 900;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--c-accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* WordPress custom-logo output — constrained to the topbar row */
.custom-logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-height: 56px;
  overflow: hidden;
}
.custom-logo,
.brand img {
  max-height: 34px;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
}

.topbar__actions { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  background: transparent;
  border: 0;
  padding: 8px;
  border-radius: 50%;
  color: var(--c-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast);
}
.icon-btn:hover { background: var(--c-bg-alt); }

/* Hamburger */
.bars { display: inline-block; width: 22px; height: 16px; position: relative; }
.bars span {
  position: absolute; left: 0; right: 0; height: 2px; background: currentColor;
  border-radius: 2px; transition: transform var(--t-base), opacity var(--t-fast);
}
.bars span:nth-child(1) { top: 0; }
.bars span:nth-child(2) { top: 7px; }
.bars span:nth-child(3) { top: 14px; }
body.drawer-open .bars span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.drawer-open .bars span:nth-child(2) { opacity: 0; }
body.drawer-open .bars span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   HEADER — TAG NAV  (row 2)
   ============================================================ */
.tag-nav {
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
  position: relative;
  z-index: 2;
}
.tag-nav__list {
  list-style: none; margin: 0; padding: 0;
  display: flex;
  gap: 0;
}
.tag-nav__list > li { flex: 0 0 auto; }
.tag-nav__list a {
  display: inline-block;
  padding: 12px 14px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--c-text);
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.tag-nav__list a:hover,
.tag-nav__list .current-menu-item > a {
  color: var(--c-accent);
  border-color: var(--c-accent);
}

/* ============================================================
   HEADER — PUBLICATIONS BAR  (row 3)
   ============================================================ */
.pub-bar {
  background: var(--c-bg-dark);
  color: #f2f2f2;
  position: relative;
  z-index: 1;
}
.pub-bar__list {
  list-style: none; margin: 0; padding: 0;
  display: flex;
  gap: 0;
}
.pub-bar__list > li { flex: 0 0 auto; }
.pub-bar__list a {
  display: inline-block;
  padding: 10px 14px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #eaeaea;
  white-space: nowrap;
  position: relative;
}
.pub-bar__list a::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 0;
  height: 3px; background: transparent;
  transition: background var(--t-fast);
}
.pub-bar__list a:hover { color: #fff; }
.pub-bar__list a:hover::after { background: var(--c-accent); }

/* Per-publication accent on hover */
.pub-bar__list .pub-item--herald a:hover::after      { background: #d02f29; }
.pub-bar__list .pub-item--chronicle a:hover::after   { background: #1b80c2; }
.pub-bar__list .pub-item--sundaymail a:hover::after  { background: #1b80c2; }
.pub-bar__list .pub-item--sundaynews a:hover::after  { background: #195f17; }
.pub-bar__list .pub-item--manicapost a:hover::after  { background: #1b80c2; }
.pub-bar__list .pub-item--hmetro a:hover::after      { background: #d02f29; }
.pub-bar__list .pub-item--bmetro a:hover::after      { background: #1b80c2; }
.pub-bar__list .pub-item--kwayedza a:hover::after    { background: #d02f29; }
.pub-bar__list .pub-item--umthunywa a:hover::after   { background: #1b80c2; }

/* ============================================================
   SEARCH PANEL
   ============================================================ */
.header-search {
  background: var(--c-bg-alt);
  border-bottom: 1px solid var(--c-border);
  padding: 12px 0;
}
.header-search .search-form { display: flex; gap: 8px; }
.header-search input[type="search"] {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius);
  font-size: var(--fs-md);
  background: #fff;
}
.header-search input[type="search"]:focus {
  outline: 2px solid var(--c-accent);
  outline-offset: -1px;
  border-color: var(--c-accent);
}
.search-submit {
  background: var(--c-accent);
  color: #fff;
  border: 0;
  padding: 0 18px;
  font-weight: 700;
  border-radius: var(--radius);
}
.search-submit:hover { background: #951212; }

.site-header.is-scrolled { box-shadow: var(--shadow-md); }

/* ============================================================
   MOBILE DRAWER
   ============================================================ */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  opacity: 0; transition: opacity var(--t-base);
  z-index: 200;
}
.drawer-overlay.is-visible { opacity: 1; }

.drawer {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: min(86vw, 340px);
  background: #fff;
  z-index: 201;
  transform: translateX(-100%);
  transition: transform var(--t-base);
  display: flex; flex-direction: column;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.drawer.is-open { transform: translateX(0); }

.drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--c-border);
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.drawer__title { font-weight: 800; letter-spacing: -0.01em; }

.drawer__section { padding: 12px 16px 4px; }
.drawer__heading {
  font-size: var(--fs-xs); font-weight: 800; text-transform: uppercase;
  letter-spacing: .08em; color: var(--c-text-muted); margin: 8px 0 6px;
}
.drawer__list { list-style: none; margin: 0 0 8px; padding: 0; }
.drawer__list li { border-bottom: 1px solid var(--c-border); }
.drawer__list a {
  display: block; padding: 12px 4px;
  font-size: var(--fs-md); font-weight: 600; color: var(--c-text);
}
.drawer__list a:hover { color: var(--c-accent); }

body.drawer-open { overflow: hidden; }

@media (min-width: 900px) {
  .menu-toggle { display: none; }
  .topbar__inner { height: 72px; }
  .brand { justify-content: flex-start; max-height: 72px; }
  .custom-logo-link { max-height: 72px; }
  .custom-logo,
  .brand img { max-height: 44px; }
  .brand__text { font-size: 1.6rem; }
  .tag-nav__list a { padding: 14px 18px; font-size: var(--fs-base); }
  .pub-bar__list a { padding: 12px 18px; font-size: var(--fs-sm); }
}

/* ============================================================
   FOOTER CONTENT
   ============================================================ */
.footer-pubs {
  padding-bottom: 24px;
  border-bottom: 1px solid #2a2a2a;
  margin-bottom: 24px;
}
.footer-heading {
  font-size: var(--fs-xs); font-weight: 800; text-transform: uppercase;
  letter-spacing: .1em; color: #9a9a9a; margin: 0 0 12px;
}
.footer-pubs__list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px 18px;
}
.footer-pubs__list a { font-size: var(--fs-sm); font-weight: 600; color: #e2e2e2; }
.footer-pubs__list a:hover { color: #fff; text-decoration: underline; }

.footer-cols { display: grid; grid-template-columns: 1fr; gap: 24px; }
.footer-col h4 {
  font-size: var(--fs-xs); font-weight: 800; text-transform: uppercase;
  letter-spacing: .1em; color: #9a9a9a; margin: 0 0 10px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin: 0 0 6px; }
.footer-col a { font-size: var(--fs-sm); }

.footer-bottom {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid #2a2a2a;
  font-size: var(--fs-xs);
  color: #8f8f8f;
  text-align: center;
}
.footer-bottom p { margin: 0; }

@media (min-width: 640px) {
  .footer-cols { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .site-footer { padding: 48px 0 24px; }
  .footer-cols { grid-template-columns: repeat(4, 1fr); gap: 32px; }
}

/* ============================================================
   TAG NAV — MEGA DROPDOWN (desktop) + accordion (mobile)
   ============================================================ */
.tag-nav__list > li { position: relative; }

.tag-nav__list > li > a {
  display: inline-flex; align-items: center; gap: 6px;
}

.tag-nav__list > li.menu-item-has-children > a::after {
  content: "";
  width: 6px; height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform var(--t-fast);
}
.tag-nav__list > li.menu-item-has-children.is-open > a::after {
  transform: rotate(-135deg) translateY(-1px);
}

.tag-nav .sub-menu {
  list-style: none; margin: 0; padding: 0;
  position: absolute; top: 100%; left: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--c-border);
  border-top: 3px solid var(--c-accent);
  box-shadow: 0 12px 28px rgba(0,0,0,.14), 0 2px 6px rgba(0,0,0,.08);
  padding: 8px 0;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity var(--t-fast), transform var(--t-fast), visibility var(--t-fast);
}

.tag-nav__list > li.is-open > .sub-menu,
.tag-nav__list > li:hover > .sub-menu {
  opacity: 1; visibility: visible; transform: translateY(0);
}

.tag-nav .sub-menu li { position: relative; }
.tag-nav .sub-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--c-text-soft);
  white-space: nowrap;
  border-bottom: 0;
  position: relative;
}
.tag-nav .sub-menu a::before {
  content: "";
  flex: 0 0 auto;
  width: 7px; height: 7px;
  border-radius: 50%;
  border: 1.5px solid var(--c-text-muted);
  background: transparent;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.tag-nav .sub-menu a:hover,
.tag-nav .sub-menu .current-menu-item > a {
  color: var(--c-accent);
}
.tag-nav .sub-menu a:hover::before,
.tag-nav .sub-menu .current-menu-item > a::before {
  border-color: var(--c-accent);
  background: var(--c-accent);
}
.tag-nav .sub-menu a::after {
  content: "";
  position: absolute;
  left: 18px; right: 18px; bottom: 4px;
  height: 2px;
  background: transparent;
  transition: background var(--t-fast);
}
.tag-nav .sub-menu a:hover::after,
.tag-nav .sub-menu .current-menu-item > a::after {
  background: var(--c-accent);
}

/* Mobile: sub-menu becomes accordion */
@media (max-width: 899px) {
  .tag-nav .sub-menu {
    position: static;
    opacity: 1; visibility: visible; transform: none;
    border: 0; box-shadow: none;
    padding: 0 0 6px 22px;
    display: none;
    background: transparent;
  }
  .tag-nav__list > li.is-open > .sub-menu { display: block; }
  .tag-nav__list > li.menu-item-has-children > a { padding-right: 34px; }
}

/* Drawer nested items */
.drawer__list .menu-item-has-children > a { position: relative; }
.drawer__list .menu-item-has-children > a::after {
  content: ""; position: absolute; right: 4px; top: 50%;
  width: 6px; height: 6px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-70%) rotate(45deg);
  transition: transform var(--t-fast);
}
.drawer__list .menu-item-has-children.is-open > a::after {
  transform: translateY(-30%) rotate(-135deg);
}
.drawer__list .sub-menu {
  list-style: none; margin: 0; padding: 0 0 6px 16px;
  display: none;
}
.drawer__list .menu-item-has-children.is-open > .sub-menu { display: block; }
.drawer__list .sub-menu a { font-weight: 500; color: var(--c-text-soft); font-size: var(--fs-sm); padding: 10px 4px; }

/* ============================================================
   HORIZONTAL SCROLL — TAG NAV + PUB BAR  (all viewports)
   ============================================================ */
.tag-nav > .container,
.pub-bar > .container {
  overflow: hidden;
  width: 100%;
  min-width: 0;
}

.tag-nav__list,
.pub-bar__list {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x proximity;
  margin: 0;
  padding: 0;
  width: 100%;
  min-width: 0;
}

.tag-nav__list::-webkit-scrollbar,
.pub-bar__list::-webkit-scrollbar { display: none; }

.tag-nav__list > li,
.pub-bar__list > li {
  flex: 0 0 auto;
  white-space: nowrap;
  scroll-snap-align: start;
}
.tag-nav__list > li > a,
.pub-bar__list > li > a {
  white-space: nowrap;
}

/* ============================================================
   HORIZONTAL SCROLL — PUBLICATION SUB-NAV (.pub-nav__list)
   Used by page-publication.php, page-single-category.php, single.php
   ============================================================ */
.pub-nav > .container {
  overflow: hidden;
  width: 100%;
  min-width: 0;
}

.pub-nav__list {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x proximity;
  margin: 0;
  padding: 0;
  width: 100%;
  min-width: 0;
  list-style: none;
}
.pub-nav__list::-webkit-scrollbar { display: none; }

.pub-nav__item {
  flex: 0 0 auto;
  white-space: nowrap;
  scroll-snap-align: start;
}
.pub-nav__item > a {
  white-space: nowrap;
}