/*
Theme Name: Define Africa 2027
Theme URI: https://definingafrica.org/
Author: Paul Njoroge
Description: Custom theme for Defining Africa Today. Light and dark modes, no page builder required.
Version: 0.2.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: dat
*/

:root {
	--bg: #F4F6F5; --surface: #FFFFFF; --ink: #0E1A16; --muted: #4F5D57;
	--line: #DDE3E0; --line-soft: #E8ECEA; --line-strong: #C9D2CE;
	--accent: #1D6E41; --accent-bg: #1D6E41; --link: #1A6FA3;
	--field: #FFFFFF; --field-line: #B9C2C9; --solid: #0E1A16; --on-solid: #FFFFFF;
	--shadow: 0 14px 32px rgba(14, 26, 22, .12);
	--serif: 'Instrument Serif', Georgia, serif;
	--sans: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
	color-scheme: light;
}
[data-theme="dark"] {
	--bg: #0F1513; --surface: #18201D; --ink: #E8EFEC; --muted: #A3B1AB;
	--line: #2A3531; --line-soft: #232D29; --line-strong: #3A4743;
	--accent: #6CCB95; --accent-bg: #1D6E41; --link: #7DBFE8;
	--field: #0F1513; --field-line: #3A4743; --solid: #E8EFEC; --on-solid: #0E1A16;
	--shadow: 0 14px 32px rgba(0, 0, 0, .45);
	color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; }
a { color: var(--ink); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent); }
h1, h2, h3 { margin: 0; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--solid); color: var(--on-solid); padding: 10px 16px; border-radius: 8px; z-index: 10; }
.skip-link:focus { left: 8px; color: var(--on-solid); }

.wrap { max-width: 1240px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.wrap--mid { max-width: 1000px; }
.wrap--narrow { max-width: 780px; }

.meta { font-size: 13px; color: var(--muted); }
.meta--accent { font-size: 14px; font-weight: 600; color: var(--accent); }
.h-section { font-family: var(--serif); font-weight: 400; font-size: 30px; }
.h-display { font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 4vw, 44px); line-height: 1.1; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 13px 22px; border-radius: 12px; border: 1px solid transparent; font: 600 16px/1.2 var(--sans); cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s, color .15s; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn--accent, .btn--accent:hover { background: var(--accent-bg); color: #fff; }
.btn--solid, .btn--solid:hover { background: var(--solid); color: var(--on-solid); }
.btn--outline { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn--square { border-radius: 4px; font-size: 15px; }
.icon-btn { width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background .15s; }
.icon-btn:hover { background: var(--line-soft); }
.icon-sun, [data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header__inner { padding-top: 28px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.site-logo a { display: block; background: #fff; padding: 6px 16px; border-radius: 14px; }
.site-logo img { height: 88px; width: auto; display: block; }
.site-logo__text { font-family: var(--serif); font-size: 40px; color: #0E1A16; }
.site-tagline { font-size: 13px; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; }
.site-nav { align-self: stretch; margin-top: 18px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 28px; padding: 8px 0; }
.site-nav ul, .site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.site-nav__menu ul { justify-content: center; gap: 4px 36px; font-size: 15px; font-weight: 600; }
.site-nav__menu a { display: block; padding: 8px 0; background: linear-gradient(var(--accent), var(--accent)) no-repeat 0 100% / 0 2px; transition: background-size .2s, color .15s; }
.site-nav__menu a:hover, .site-nav__menu .current-menu-item > a, .site-nav__menu .current-cat > a { background-size: 100% 2px; color: var(--accent); }
.site-nav__tools { display: flex; gap: 6px; padding-left: 20px; border-left: 1px solid var(--line); }
.site-search { align-self: stretch; padding: 4px 0 20px; }
.search-form { display: flex; gap: 10px; max-width: 640px; margin: 0 auto; }
.search-form input[type="search"] { flex: 1; min-width: 0; }

/* Fields */
input[type="text"], input[type="email"], input[type="tel"], input[type="search"], textarea { height: 44px; border: 1px solid var(--field-line); border-radius: 4px; padding: 0 12px; font: 15px var(--sans); background: var(--field); color: var(--ink); width: 100%; }
textarea { height: auto; padding: 10px 12px; resize: vertical; }

/* Home: lead */
.lead { padding-top: 64px; padding-bottom: 56px; display: flex; flex-wrap: wrap; gap: 48px; align-items: flex-start; }
.lead__story { flex: 1 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.lead__media { display: block; width: 100%; border-radius: 18px; overflow: hidden; }
.lead__media img, .lead__media .dat-noimg { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; transition: transform .5s ease; }
.lead__story:hover .lead__media img { transform: scale(1.03); }
.lead__title { font-family: var(--serif); font-weight: 400; font-size: clamp(36px, 4.4vw, 52px); line-height: 1.04; letter-spacing: -.5px; }
.lead__excerpt { margin: 0; font-size: 18px; line-height: 1.6; color: var(--muted); }

.headlines { flex: 1 1 420px; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px; }
.headlines .h-section { margin-bottom: 8px; }
.headlines ol { margin: 0; padding: 0; list-style: none; }
.headlines li { border-top: 1px solid var(--line-soft); }
.headline { display: flex; gap: 16px; align-items: center; padding: 16px 0; }
.headline__media { flex-shrink: 0; width: 140px; height: 96px; border-radius: 10px; overflow: hidden; }
.headline__media img, .headline__media .dat-noimg { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.headline:hover .headline__media img { transform: scale(1.06); }
.headline__text { display: flex; flex-direction: column; gap: 4px; }
.headline__title { font-weight: 600; line-height: 1.35; }

/* Cards */
.stories { padding-bottom: 64px; }
.stories__head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.stories--related { padding-top: 56px; }
.stories--related .h-display { margin-bottom: 28px; }
.stories__more { display: flex; justify-content: center; margin-top: 28px; }
.filter { display: flex; flex-wrap: wrap; gap: 6px; background: var(--surface); border: 1px solid var(--line); padding: 5px; border-radius: 12px; }
.filter button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font: 14px var(--sans); cursor: pointer; transition: background .15s; }
.filter button:hover { background: var(--line-soft); }
.filter button[aria-pressed="true"] { background: var(--solid); color: var(--on-solid); font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; transition: opacity .2s; }
.grid.is-loading { opacity: .45; pointer-events: none; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--line-strong); color: var(--ink); }
.card__media { display: block; overflow: hidden; }
.card__media img, .card__media .dat-noimg { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; transition: transform .5s ease; }
.card:hover .card__media img { transform: scale(1.05); }
.card__body { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 10px; }
.card__meta { font-size: 13px; font-weight: 600; color: var(--accent); }
.card__title { font-family: var(--serif); font-size: 26px; line-height: 1.15; transition: color .15s; }
.card:hover .card__title { color: var(--accent); }
.dat-noimg { background: linear-gradient(135deg, var(--line-soft), var(--line-strong)); }

/* About + contact */
.about-contact { padding-top: 64px; padding-bottom: 64px; display: flex; flex-direction: column; gap: 24px; }
.about { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 40px; display: flex; flex-wrap: wrap; gap: 24px 56px; scroll-margin-top: 24px; }
.about__head { flex: 1 1 340px; display: flex; flex-direction: column; gap: 10px; }
.about h2, .contact h2 { font-family: var(--serif); font-weight: 400; font-size: 40px; line-height: 1.1; }
.about p { flex: 1 1 460px; margin: 0; font-size: 17px; line-height: 1.7; color: var(--muted); }
.about p a, .contact__links a, .prose a { color: var(--link); text-decoration: underline; }
.contact { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 48px; padding-top: 32px; scroll-margin-top: 24px; }
.contact__info { display: flex; flex-direction: column; gap: 14px; }
.contact__info p { margin: 0; line-height: 1.6; }
.contact__address { color: var(--muted); }
.contact__links { display: flex; flex-direction: column; gap: 4px; }
.contact__links a { text-decoration: none; }
.contact__form { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 28px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.contact__form h3, .contact__form .notice, .field--full { grid-column: 1 / -1; }
.contact__form h3 { font-size: 18px; font-weight: 600; }
.contact__form .btn { justify-self: start; height: 46px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; }
.hp { position: absolute; left: -9999px; }
.notice { margin: 0; padding: 10px 14px; border-radius: 6px; font-size: 14px; border: 1px solid var(--line-strong); }
.notice--ok { border-color: var(--accent); color: var(--accent); }

/* Listings */
.listing { padding-top: 56px; padding-bottom: 72px; }
.listing__head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 32px; }
.listing__desc { color: var(--muted); max-width: 720px; }
.pagination { margin-top: 36px; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pagination .page-numbers { min-width: 44px; height: 44px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 600; }
.pagination .page-numbers.current { background: var(--solid); color: var(--on-solid); border-color: var(--solid); }
.notfound { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.notfound .search-form { margin: 0; width: 100%; }

/* Article */
.article { padding-top: 56px; }
.article__head { display: flex; flex-direction: column; gap: 14px; margin-bottom: 32px; }
.article__head h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(36px, 5vw, 56px); line-height: 1.05; letter-spacing: -.5px; }
.article__standfirst { margin: 0; font-size: 20px; line-height: 1.5; color: var(--muted); }
.article__media { margin: 0 auto 36px; }
.article__media img { width: 100%; border-radius: 18px; display: block; }
.article__media figcaption, .prose figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); }
.prose { font-size: 19px; line-height: 1.75; padding-bottom: 24px; overflow-wrap: break-word; }
.prose > * { margin: 0 0 1.3em; }
.prose h2, .prose h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin-top: 1.6em; }
.prose h2 { font-size: 34px; } .prose h3 { font-size: 27px; }
.prose img { border-radius: 12px; }
.prose figure { margin-left: 0; margin-right: 0; }
.prose blockquote { margin-left: 0; margin-right: 0; padding-left: 22px; border-left: 3px solid var(--accent); font-family: var(--serif); font-size: 26px; line-height: 1.35; }
.prose table { width: 100%; border-collapse: collapse; font-size: 16px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.prose iframe { max-width: 100%; }

/* Footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); }
.site-footer__inner { padding-top: 28px; padding-bottom: 32px; display: flex; flex-direction: column; gap: 20px; font-size: 14px; color: var(--muted); }
.site-footer ul { gap: 8px 24px; }
.site-footer__bottom { display: flex; flex-wrap: wrap; gap: 12px 32px; justify-content: space-between; align-items: center; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.site-footer__legal a { color: var(--muted); }
.site-footer__legal a:hover { color: var(--accent); }

@media (max-width: 640px) {
	.lead { padding-top: 36px; gap: 32px; }
	.site-logo img { height: 68px; }
	.site-nav__menu ul { gap: 0 22px; }
	.headlines, .about, .contact__form { padding: 20px; }
	.headline__media { width: 104px; height: 76px; }
	.contact__form { grid-template-columns: 1fr; }
	.prose { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; }
	.card:hover, .btn:hover { transform: none; }
	.card:hover .card__media img, .headline:hover .headline__media img, .lead__story:hover .lead__media img { transform: none; }
}
