/*
Theme Name: Daily Maverick
Theme URI: https://www.dailymaverick.co.za
Author: Daily Maverick
Author URI: https://www.dailymaverick.co.za
Description: A news-focused WordPress theme inspired by Daily Maverick's clean, professional editorial layout.
Version: 1.1.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: daily-maverick
Tags: news, blog, grid, responsive, two-columns, three-columns, custom-header, featured-images
*/

/* =============================================
   CSS CUSTOM PROPERTIES
   ============================================= */
:root {
    --red:         #ec1c24;
    --red-dark:    #c41319;
    --black:       #1a1a1a;
    --black-2:     #474747;
    --black-3:     #2d2d2d;
    --gray-light:  #f5f5f5;
    --gray-border: #e2e2e2;
    --gray-200:    #e5e7eb;
    --white:       #ffffff;
    --blue-link:   #2779f6;
    --sponsor:     #b8860b;

    --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-serif: 'Charis SIL', Georgia, 'Times New Roman', serif;

    --max-w:         1200px;
    --header-h:      52px;
    --gap:           1.5rem;
    --transition:    200ms ease;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    font-size: 16px;
    color: var(--black);
    background: var(--white);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

/* =============================================
   ACCESSIBILITY
   ============================================= */
.screen-reader-text {
    clip: rect(1px,1px,1px,1px);
    clip-path: inset(50%);
    height: 1px; width: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
}
.skip-link {
    background: var(--red);
    color: var(--white);
    font-weight: 700;
    left: 0; top: -100%;
    padding: 0.75rem 1rem;
    position: absolute;
    z-index: 999;
    text-decoration: none;
}
.skip-link:focus { top: 0; }

/* =============================================
   LAYOUT CONTAINER
   ============================================= */
.dm-container {
    max-width: var(--max-w);
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}
@media (min-width: 768px) {
    .dm-container { padding-left: 1.5rem; padding-right: 1.5rem; }
}

/* =============================================
   SITE HEADER
   ============================================= */
.site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 180;
    height: var(--header-h);
    background: var(--white);
    border-bottom: 1px solid var(--gray-border);
    transition: box-shadow var(--transition), transform var(--transition);
}
.site-header.scrolled   { box-shadow: 0 2px 10px rgba(0,0,0,.10); }
.site-header.header-hidden { transform: translateY(-100%); }

.header-inner {
    max-width: var(--max-w);
    height: 100%;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 0;
}

/* --- Logo ---- */
.header-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    /* centre on mobile via absolute, push left on desktop */
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}
@media (min-width: 1024px) {
    .header-logo {
        position: static;
        transform: none;
        margin-right: 1.5rem;
    }
}
.header-logo-link { display: flex; align-items: center; text-decoration: none; }
.header-logo-link img { height: 34px; width: auto; }
.header-site-name {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: .04em;
    color: var(--red);
    text-transform: uppercase;
}

/* --- Desktop nav ---- */
.header-nav {
    display: none;
    height: 100%;
    align-items: stretch;
    flex: 1;
    overflow: hidden;
}
@media (min-width: 1024px) { .header-nav { display: flex; } }

/* Every direct nav link / menu item anchor */
.header-nav .nav-item,
.header-nav > a {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 14px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--black);
    white-space: nowrap;
    border-left: 1px solid var(--gray-border);
    transition: background var(--transition), color var(--transition);
    position: relative;
}
.header-nav .nav-item:first-child,
.header-nav > a:first-child { border-left: none; }
.header-nav .nav-item:hover,
.header-nav > a:hover {
    background: var(--black);
    color: var(--white);
}

/* WordPress menu items generated by Walker */
.header-nav li {
    list-style: none;
    height: 100%;
    position: relative;
}
.header-nav li > a {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 14px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--black);
    white-space: nowrap;
    border-left: 1px solid var(--gray-border);
    transition: background var(--transition), color var(--transition);
}
.header-nav li:hover > a { background: var(--black); color: var(--white); }

/* Dropdown */
.header-nav li ul {
    display: none;
    position: absolute;
    top: 100%; left: 0;
    min-width: 200px;
    background: var(--white);
    border: 1px solid var(--gray-border);
    border-top: 2px solid var(--red);
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
    z-index: 200;
    list-style: none;
}
.header-nav li:hover > ul { display: block; }
.header-nav li ul li a {
    display: block;
    height: auto;
    padding: .65rem 1rem;
    border-left: none;
    border-bottom: 1px solid var(--gray-border);
    font-size: .7rem;
}
.header-nav li ul li:last-child a { border-bottom: none; }
.header-nav li ul li a:hover { background: var(--black); color: var(--white); }

/* --- Header right ---- */
.header-right {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-left: auto;
    flex-shrink: 0;
}
.search-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--black-2);
    padding: .25rem;
    display: flex;
    align-items: center;
}
.search-toggle:hover { color: var(--red); }

.header-support-btn {
    display: none;
    padding: .35rem .9rem;
    background: var(--red);
    color: var(--white);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    text-decoration: none;
    transition: background var(--transition);
}
.header-support-btn:hover { background: var(--red-dark); }
@media (min-width: 1024px) { .header-support-btn { display: inline-block; } }

/* --- Mobile hamburger ---- */
.mobile-menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--black);
    padding: .25rem;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    z-index: 1;
}
@media (min-width: 1024px) { .mobile-menu-toggle { display: none; } }

/* --- Search panel ---- */
.search-panel {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--gray-border);
    padding: .75rem 1rem;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    z-index: 100;
}
.search-panel.is-open { display: block; }
.search-panel-inner { max-width: var(--max-w); margin: 0 auto; }
.search-form { display: flex; border: 1px solid var(--gray-border); max-width: 600px; }
.search-field {
    flex: 1; border: none; outline: none;
    padding: .6rem .75rem;
    font-family: var(--font-sans);
    font-size: .9rem;
}
.search-submit {
    background: var(--black); color: var(--white);
    border: none; padding: 0 .75rem;
    cursor: pointer; display: flex; align-items: center;
}
.search-submit:hover { background: var(--red); }

/* =============================================
   MOBILE MENU
   ============================================= */
.mobile-menu {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 190;
}
.mobile-menu.is-open { display: flex; }

.mobile-menu-panel {
    position: relative;
    width: 80%;
    max-width: 320px;
    height: 100%;
    background: var(--white);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0,0,0,.15);
    z-index: 1;
}
.mobile-menu-backdrop {
    flex: 1;
    background: rgba(0,0,0,.55);
    border: none;
    cursor: pointer;
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-border);
    flex-shrink: 0;
}
.mobile-menu-logo { text-decoration: none; }
.mobile-menu-logo img { height: 28px; width: auto; }
.mobile-menu-close {
    background: none; border: none;
    cursor: pointer; color: var(--black);
    padding: .25rem; display: flex; align-items: center;
}

.mobile-nav-list { list-style: none; flex: 1; }
.mobile-nav-list li a {
    display: block;
    padding: .875rem 1rem;
    font-size: .875rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--black);
    border-bottom: 1px solid var(--gray-border);
    transition: background var(--transition);
}
.mobile-nav-list li a:hover { background: var(--gray-light); color: var(--red); }
/* Sub-items */
.mobile-nav-list li ul { list-style: none; }
.mobile-nav-list li ul li a {
    padding-left: 2rem;
    font-size: .8125rem;
    font-weight: 400;
    color: var(--black-2);
}

.mobile-menu-footer { padding: 1rem; border-top: 1px solid var(--gray-border); flex-shrink: 0; }
.mobile-support-btn {
    display: block;
    text-align: center;
    padding: .75rem;
    background: var(--red);
    color: var(--white);
    font-size: .8125rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    text-decoration: none;
}
.mobile-support-btn:hover { background: var(--red-dark); }

body.menu-open { overflow: hidden; }

/* =============================================
   MAIN CONTENT OFFSET FOR FIXED HEADER
   ============================================= */
.main-content-wrap { margin-top: var(--header-h); }

/* =============================================
   HERO SECTION
   ============================================= */
.dm-hero { padding: 1.5rem 0 2rem; }

.hero-inner {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}
@media (min-width: 1024px) {
    .hero-inner { grid-template-columns: 2fr 1fr; }
}

.hero-main-link { display: block; text-decoration: none; color: inherit; }
.hero-img-wrap { overflow: hidden; aspect-ratio: 16/9; }
.hero-img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .35s ease;
}
.hero-main-link:hover .hero-img { transform: scale(1.03); }
.hero-content { padding: .75rem 0 0; }
.hero-category {
    font-size: .65rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .1em;
    color: var(--red); display: block; margin-bottom: .4rem;
}
.hero-title {
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    font-weight: 800; line-height: 1.15;
    margin-bottom: .6rem; color: var(--black);
}
.hero-excerpt { color: var(--black-2); font-size: 1rem; line-height: 1.55; margin-bottom: .75rem; }
.hero-meta { font-size: .75rem; color: #888; display: flex; gap: .75rem; }

/* Hero sidebar */
.hero-sidebar {
    border-top: 2px solid var(--black);
    display: flex;
    flex-direction: column;
}
@media (min-width: 1024px) {
    .hero-sidebar {
        border-top: none;
        border-left: 1px solid var(--gray-border);
        padding-left: 1.25rem;
    }
}
.hero-sidebar-item {
    padding: .875rem 0;
    border-bottom: 1px solid var(--gray-border);
}
.hero-sidebar-item:last-child { border-bottom: none; }
.hero-sidebar-link {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    text-decoration: none;
    color: inherit;
}
.hero-sidebar-content { flex: 1; }
.sidebar-cat {
    font-size: .6rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .1em;
    color: var(--red); display: block; margin-bottom: .2rem;
}
.sidebar-title {
    font-size: .9rem; font-weight: 700; line-height: 1.3;
    color: var(--black); margin-bottom: .25rem;
    transition: color var(--transition);
}
.hero-sidebar-link:hover .sidebar-title { color: var(--red); }
.sidebar-date { font-size: .7rem; color: #999; }
.sidebar-thumb { flex-shrink: 0; }
.sidebar-thumb img { width: 80px; height: 56px; object-fit: cover; }

/* =============================================
   FEATURED GRID STRIP
   ============================================= */
.dm-featured-grid { background: var(--gray-light); padding: 2rem 0; }

/* =============================================
   ARTICLE GRIDS
   ============================================= */
.article-grid { display: grid; gap: var(--gap); }
.article-grid--3col { grid-template-columns: 1fr; }
@media (min-width: 640px)  { .article-grid--3col { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .article-grid--3col { grid-template-columns: repeat(3, 1fr); } }

/* =============================================
   ARTICLE CARD – STANDARD
   ============================================= */
.dm-card {
    display: flex;
    flex-direction: column;
    background: var(--white);
}
.dm-card .card-img-link { display: block; overflow: hidden; text-decoration: none; }
.dm-card .card-img-wrap { aspect-ratio: 16/9; overflow: hidden; }
.dm-card .card-img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .35s ease;
}
.dm-card:hover .card-img { transform: scale(1.04); }
.dm-card .card-body {
    padding: .65rem 0 0;
    flex: 1; display: flex; flex-direction: column; gap: .3rem;
}
.card-cat {
    font-size: .62rem; font-weight: 700;
    letter-spacing: .1em; text-transform: uppercase;
    color: var(--red); text-decoration: none;
}
.card-title { font-size: 1rem; font-weight: 700; line-height: 1.3; }
.card-title a { color: var(--black); text-decoration: none; }
.card-title a:hover { color: var(--red); }
.card-excerpt { font-size: .875rem; color: var(--black-2); line-height: 1.5; }
.card-meta {
    font-size: .72rem; color: #888;
    display: flex; gap: .5rem; margin-top: auto; padding-top: .35rem;
}

/* =============================================
   ARTICLE CARD – LIST (horizontal)
   ============================================= */
.dm-card-list {
    display: flex;
    gap: .875rem;
    align-items: flex-start;
    padding: .875rem 0;
    border-bottom: 1px solid var(--gray-border);
}
.dm-card-list:last-child { border-bottom: none; }
.dm-card-list .card-list-body { flex: 1; display: flex; flex-direction: column; gap: .25rem; }
.dm-card-list .card-list-img-link { flex-shrink: 0; text-decoration: none; }
.dm-card-list .card-list-img { width: 110px; height: 74px; object-fit: cover; }
.dm-card-list .card-title { font-size: .9375rem; }

/* =============================================
   CONTENT + SIDEBAR LAYOUT
   ============================================= */
.content-sidebar-wrap {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding-top: 1.5rem;
}
@media (min-width: 1024px) {
    .content-sidebar-wrap { grid-template-columns: 1fr 300px; }
}
.sidebar { display: flex; flex-direction: column; gap: 2rem; }

/* =============================================
   SECTION HEADINGS
   ============================================= */
.section-heading {
    font-size: .875rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: .08em;
    border-left: 3px solid var(--red);
    padding-left: .65rem;
    margin: 0 0 1rem;
    color: var(--black);
}
.section-heading a { color: inherit; text-decoration: none; }
.section-heading a:hover { color: var(--red); }

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.see-all {
    font-size: .7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em;
    color: var(--red); text-decoration: none;
}
.see-all:hover { text-decoration: underline; }

/* =============================================
   CATEGORY SECTIONS
   ============================================= */
.dm-category-section { padding: 1.5rem 0; border-top: 2px solid var(--black); }
.dm-more-stories { margin-bottom: 2rem; }

/* =============================================
   TOP READS WIDGET
   ============================================= */
.widget-top-reads { }
.widget-title {
    font-size: .8rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: .1em;
    border-left: 3px solid var(--red);
    padding-left: .65rem;
    margin-bottom: .75rem;
    color: var(--black);
}
.top-reads-list { list-style: none; }
.top-reads-item {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    padding: .75rem 0;
    border-bottom: 1px solid var(--gray-border);
}
.top-reads-item:last-child { border-bottom: none; }
.top-reads-num {
    font-size: 2rem; font-weight: 800;
    color: var(--gray-200); line-height: 1;
    width: 2.25rem; text-align: right;
    flex-shrink: 0;
}
.top-reads-content { flex: 1; display: flex; flex-direction: column; gap: .2rem; }
.top-reads-cat {
    font-size: .6rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .1em;
    color: var(--red);
}
.top-reads-title {
    font-size: .875rem; font-weight: 700; line-height: 1.3;
    text-decoration: none; color: var(--black);
}
.top-reads-title:hover { color: var(--red); }

/* =============================================
   SIDEBAR WIDGETS
   ============================================= */
.widget { }
.widget .widget-title { /* same as above */ }

/* =============================================
   SINGLE ARTICLE
   ============================================= */
.single-article { max-width: 740px; }
.article-header { margin-bottom: 1.25rem; }
.article-cats { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-bottom: .4rem; }
.article-cats a { color: var(--red); text-decoration: none; }
.article-title { font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 800; line-height: 1.15; margin-bottom: .75rem; }
.article-meta { font-size: .8rem; color: #888; display: flex; gap: .75rem; flex-wrap: wrap; }
.article-meta a { color: var(--black); font-weight: 600; text-decoration: none; }
.article-featured-img { margin: 0 0 1.5rem; }
.article-featured-img img { width: 100%; height: auto; }
.article-featured-img figcaption { font-size: .8rem; color: #888; font-style: italic; padding: .5rem 0; }
.article-body {
    font-family: var(--font-serif);
    font-size: 1.0625rem; line-height: 1.75;
    color: var(--black);
}
.article-body h2, .article-body h3 { font-family: var(--font-sans); margin: 1.5rem 0 .75rem; }
.article-body p { margin-bottom: 1.25rem; }
.article-body a { color: var(--blue-link); }
.article-body img { margin: 1.25rem 0; }

.article-footer {
    margin-top: 2rem; padding-top: 1.5rem;
    border-top: 1px solid var(--gray-border);
    display: flex; flex-direction: column; gap: 1rem;
}
.article-tags a {
    display: inline-block;
    border: 1px solid var(--gray-border);
    padding: .25rem .5rem;
    font-size: .75rem;
    margin: .2rem; text-decoration: none;
    color: var(--black-2);
}
.article-share {
    display: flex; align-items: center;
    gap: .5rem; flex-wrap: wrap;
    font-size: .8rem; font-weight: 600;
}
.share-btn {
    padding: .35rem .75rem; font-size: .75rem;
    font-weight: 700; text-decoration: none;
    background: var(--black-3); color: var(--white);
}
.share-btn:hover { background: var(--red); }

.post-navigation {
    display: flex; justify-content: space-between;
    padding: 1.5rem 0;
    border-top: 1px solid var(--gray-border);
    margin-top: 2rem; font-size: .875rem;
}
.post-navigation a { color: var(--black); text-decoration: none; font-weight: 600; }
.post-navigation a:hover { color: var(--red); }

/* =============================================
   ARCHIVE
   ============================================= */
.archive-header {
    padding: 1.5rem 0;
    border-bottom: 2px solid var(--black);
    margin-bottom: 1.5rem;
}
.archive-title { font-size: 1.75rem; font-weight: 800; }
.archive-description { color: var(--black-2); margin-top: .5rem; }

/* =============================================
   FOOTER
   ============================================= */
.site-footer {
    background: var(--black);
    color: var(--white);
    padding: 3rem 0 1.5rem;
    margin-top: 3rem;
}
.footer-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 1rem;
}
@media (min-width: 768px) { .footer-inner { padding: 0 1.5rem; } }

.footer-logo-row { margin-bottom: 2rem; }
.footer-logo-link { display: inline-block; text-decoration: none; }
.footer-logo-link img { height: 36px; width: auto; filter: brightness(0) invert(1); }
.footer-site-name {
    font-size: 1.5rem; font-weight: 800;
    color: var(--white); letter-spacing: .04em;
}
.footer-tagline {
    font-size: .65rem; letter-spacing: .22em;
    text-transform: uppercase; color: rgba(255,255,255,.45);
    margin-top: .3rem;
}
.footer-nav { margin-bottom: 2rem; }
.footer-menu {
    list-style: none;
    display: flex; flex-wrap: wrap;
    gap: 0;
}
.footer-menu li { }
.footer-menu li a {
    display: block;
    padding: .4rem 1rem .4rem 0;
    font-size: .8rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em;
    color: rgba(255,255,255,.65); text-decoration: none;
}
.footer-menu li a:hover { color: var(--white); }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.15);
    padding-top: 1.25rem;
    display: flex; justify-content: space-between;
    flex-wrap: wrap; gap: .5rem;
}
.footer-copyright, .footer-legal { font-size: .75rem; color: rgba(255,255,255,.4); }
.footer-legal a { color: rgba(255,255,255,.4); text-decoration: none; margin-left: 1rem; }
.footer-legal a:hover { color: rgba(255,255,255,.8); }

/* =============================================
   404
   ============================================= */
.error-404 { text-align: center; padding: 5rem 1rem; }
.error-title { font-size: 3rem; font-weight: 800; margin-bottom: 1rem; }
.error-desc { color: var(--black-2); margin-bottom: 2rem; }
.btn { display: inline-block; padding: .75rem 1.5rem; font-weight: 700; text-decoration: none; font-size: .875rem; text-transform: uppercase; letter-spacing: .06em; cursor: pointer; }
.btn-primary { background: var(--red); color: var(--white); }
.btn-primary:hover { background: var(--red-dark); }

/* =============================================
   PAGINATION
   ============================================= */
.pagination { padding: 2rem 0; }
.nav-links { display: flex; gap: .25rem; flex-wrap: wrap; }
.page-numbers {
    display: inline-block;
    padding: .4rem .7rem; font-size: .875rem;
    font-weight: 600;
    border: 1px solid var(--gray-border);
    text-decoration: none; color: var(--black);
}
.page-numbers.current { background: var(--black); color: var(--white); border-color: var(--black); }
.page-numbers:hover:not(.current) { background: var(--gray-light); }

/* =============================================
   WORDPRESS CORE REQUIRED
   ============================================= */
.alignleft  { float: left;  margin: 0 1.5rem 1rem 0; }
.alignright { float: right; margin: 0 0 1rem 1.5rem; }
.aligncenter { display: block; margin: 0 auto 1rem; text-align: center; }
.wp-caption { max-width: 100%; }
.wp-caption-text { font-size: .8125rem; color: #666; font-style: italic; }
.sticky { }
.bypostauthor { }
.gallery { display: flex; flex-wrap: wrap; gap: .5rem; }
.gallery img { object-fit: cover; }
