/*
Theme Name: Statecraft
Theme URI: https://statecraft.pk
Author: Abdullah Mir
Description: A custom news theme for Statecraft — navy and gold, built for national affairs, foreign policy and security reporting. Includes a lead-story homepage, category sections, trending list, breaking-news bar, YouTube section, newsletter signup, reader tip form and dark mode. Settings: Appearance → Customize → Statecraft settings.
Version: 1.3.1
Requires at least: 6.2
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: statecraft
Tags: news, blog, two-columns, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready
*/

/* ---------- Fonts (served from this site; OFL licensed, see assets/fonts) ---------- */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("assets/fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("assets/fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("assets/fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("assets/fonts/inter-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 500; font-display: swap; src: url("assets/fonts/newsreader-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 700; font-display: swap; src: url("assets/fonts/newsreader-latin-700-normal.woff2") format("woff2"); }

/* ---------- Tokens ---------- */
:root {
	--navy: #0B1F3A;
	--navy-2: #16305A;
	--navy-line: #1E3557;
	--gold: #C9A54A;
	--gold-soft: #E3C77A;
	--on-navy: #F3F5F9;
	--on-navy-muted: #B8C4D9;

	--bg: #F3F5F9;
	--fg: #0B1F3A;
	--muted: #4F5B6E;
	--card: #FFFFFF;
	--line: #D9DFE9;
	--ph: #DCE2EC;
	--accent: #1D4A8C;
	--on-accent: #FFFFFF;

	--serif: "Newsreader", Georgia, "Times New Roman", serif;
	--sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--wrap: 1240px;
	--gap: 32px;
}

[data-theme="dark"] {
	--bg: #081426;
	--fg: #E8EDF5;
	--muted: #A7B4C9;
	--card: #0F1F38;
	--line: #22365A;
	--ph: #182B4A;
	--accent: #8FB4E8;
	--on-accent: #081426;
	color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: rgba(201, 165, 74, .25); }
a, button, input, textarea, select, label { touch-action: manipulation; }
body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font-family: var(--sans);
	font-size: 16px;
	line-height: 1.55;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
	outline: 3px solid var(--gold);
	outline-offset: 2px;
}
h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.15; margin: 0; font-weight: 700; }
button { font-family: inherit; cursor: pointer; }

.container { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link:focus {
	clip: auto; width: auto; height: auto; margin: 0;
	left: 12px; top: 12px; z-index: 1000;
	background: var(--gold); color: var(--navy); padding: 10px 16px; font-weight: 600;
}

/* ---------- Buttons & forms ---------- */
.button {
	display: inline-flex; align-items: center; justify-content: center;
	min-height: 44px; padding: 0 20px; border: 0;
	background: var(--accent); color: var(--on-accent);
	font-weight: 600; font-size: 15px; text-decoration: none;
}
.button:hover { filter: brightness(1.08); text-decoration: none; }
.button--full { width: 100%; }

input[type="text"], input[type="email"], input[type="search"], input[type="url"], textarea {
	width: 100%; min-height: 44px; padding: 10px 12px;
	border: 1px solid var(--line); background: var(--bg); color: var(--fg);
	font: inherit; font-size: 16px; /* 16px stops iPhones zooming in when a field is tapped */
	border-radius: 0; -webkit-appearance: none; appearance: none;
}
label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0 6px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; }
.inline-form input { flex: 1 1 220px; }
.sc-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.notice { padding: 10px 12px; font-size: 14px; margin: 0 0 12px; }
.notice--ok { background: rgba(46, 140, 90, .12); border-left: 3px solid #2E8C5A; }
.notice--err { background: rgba(190, 40, 40, .1); border-left: 3px solid #BE2828; }

/* ---------- Header ---------- */
.site-header { background: var(--navy); color: var(--on-navy); }
.masthead {
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
	gap: 16px; padding-top: 18px; padding-bottom: 18px;
}
.masthead__date { font-size: 13px; color: var(--on-navy-muted); flex: 1 1 200px; }
.masthead__brand { flex: 0 1 auto; text-align: center; }
.masthead__brand .custom-logo { max-height: 64px; width: auto; margin: 0 auto; }
.masthead__actions { flex: 1 1 200px; display: flex; justify-content: flex-end; align-items: center; gap: 10px; }

.wordmark { display: inline-flex; align-items: center; gap: 12px; color: var(--on-navy); }
.wordmark:hover { text-decoration: none; }
.wordmark__mark { width: 14px; height: 14px; background: var(--gold); transform: rotate(45deg); }
.wordmark__text { font-family: var(--serif); font-size: 40px; font-weight: 700; letter-spacing: .5px; line-height: 1; }

.icon-button, .pill-button {
	min-height: 44px; border: 1px solid #2C4670; background: transparent; color: var(--on-navy);
	display: inline-flex; align-items: center; justify-content: center;
}
.icon-button { width: 44px; border-radius: 22px; }
.pill-button { padding: 0 16px; border-radius: 22px; font-size: 13px; font-weight: 500; gap: 8px; }
.theme-toggle__icon--sun { display: none; }
[data-theme="dark"] .theme-toggle__icon--sun { display: block; }
[data-theme="dark"] .theme-toggle__icon--moon { display: none; }
.pill-button:hover, .icon-button:hover { border-color: var(--gold); text-decoration: none; }
.pill-button--gold { background: var(--gold); border-color: var(--gold); color: var(--navy); font-weight: 600; font-size: 14px; }

.search-panel { border-top: 1px solid var(--navy-line); padding: 14px 0; }
.search-panel input[type="search"] { background: #fff; color: #0B1F3A; }

.primary-nav { border-top: 1px solid var(--navy-line); position: relative; }
.primary-nav::before, .primary-nav::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40px; pointer-events: none; opacity: 0; transition: opacity .2s; z-index: 1; }
.primary-nav::before { left: 0; background: linear-gradient(to right, var(--navy), rgba(11, 31, 58, 0)); }
.primary-nav::after { right: 0; background: linear-gradient(to left, var(--navy), rgba(11, 31, 58, 0)); }
.primary-nav.has-more::after, .primary-nav.has-less::before { opacity: 1; }
.primary-menu {
	list-style: none; margin: 0; padding: 0;
	display: flex; gap: 4px 26px; overflow-x: auto; scrollbar-width: none;
	-webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
.primary-menu::-webkit-scrollbar { display: none; }
.primary-menu a { display: block; padding: 14px 0; font-size: 14px; font-weight: 500; color: #DCE4F2; white-space: nowrap; }
.primary-menu .current-menu-item > a, .primary-menu .current-category-ancestor > a { color: var(--gold-soft); box-shadow: inset 0 -3px 0 var(--gold); }

/* ---------- Breaking bar ---------- */
.breaking { background: var(--gold); color: var(--navy); }
.breaking__inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding-top: 10px; padding-bottom: 10px; font-size: 14px; }
.breaking__label { background: var(--navy); color: var(--gold); font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; padding: 4px 8px; }
.breaking__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 20px; font-weight: 500; }

/* ---------- Shared pieces ---------- */
.kicker { font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); margin: 14px 0 6px; }
.kicker a { color: inherit; display: inline-block; padding: 10px 0; margin: -10px 0; }
.byline { font-size: 13px; color: var(--muted); }
.byline a { color: var(--fg); font-weight: 600; display: inline-block; padding: 8px 0; margin: -8px 0; }

.thumb { display: block; aspect-ratio: 16 / 9; background: var(--ph); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.thumb:hover img { transform: scale(1.03); }
.thumb__placeholder { display: block; width: 100%; height: 100%; background: var(--ph); }

.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-top: 3px solid var(--fg); padding-top: 10px; margin-bottom: 14px; }
.section-head__title { font-size: 26px; }
.section-head__more { font-size: 13px; font-weight: 600; color: var(--accent); white-space: nowrap; padding: 12px 0; margin: -12px 0; }

.box { background: var(--card); border: 1px solid var(--line); padding: 20px; }
.box + .box { margin-top: 24px; }
.box__title { font-size: 24px; margin-bottom: 8px; }
.box__text { font-size: 14px; color: var(--muted); margin: 0 0 12px; }
.tip-box textarea { min-height: 96px; }
.tip-box .button { margin-top: 14px; }

/* ---------- Homepage ---------- */
.front { padding-top: 32px; }
.hero { display: flex; flex-wrap: wrap; gap: var(--gap); }
.card-lead { flex: 999 1 560px; min-width: 0; }
.card-lead__title { font-size: clamp(30px, 4vw, 44px); margin: 6px 0 12px; }
.card-lead__dek { font-size: 17px; color: var(--muted); margin: 0 0 10px; }
.hero__side { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.card-side { padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.card-side__title { font-size: 22px; margin: 4px 0 8px; }

.home__grid { display: flex; flex-wrap: wrap; gap: var(--gap); margin-top: 48px; }
.home__main { flex: 999 1 640px; min-width: 0; }
.home__aside { flex: 1 1 300px; min-width: 0; }

.sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 40px 32px; }
.card__title { font-size: 21px; margin: 4px 0 8px; line-height: 1.25; }
.cat-section .card { margin-bottom: 6px; }
.headline-list { list-style: none; margin: 0; padding: 0; }
.headline-list__item a { display: block; padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; line-height: 1.4; font-weight: 500; }

.latest { margin-top: 48px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 28px 24px; }

.trending__list { list-style: none; margin: 0; padding: 0; }
.trending__item { display: flex; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.trending__item a { font-size: 15px; line-height: 1.4; font-weight: 500; }
.trending__num { font-family: var(--serif); font-size: 28px; font-weight: 700; color: var(--accent); min-width: 24px; line-height: 1; }

/* Videos */
.videos { margin-top: 56px; background: var(--navy); color: var(--on-navy); padding: 32px; }
.videos__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 20px; }
.videos__title { font-size: 30px; }
.videos__more { font-size: 14px; font-weight: 600; color: var(--gold-soft); }
.videos__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.video { display: flex; flex-direction: column; gap: 8px; }
.video:hover { text-decoration: none; }
.video__thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--navy-2); overflow: hidden; }
.video__thumb img { width: 100%; height: 100%; object-fit: cover; opacity: .9; }
.video__play { position: absolute; inset: 0; margin: auto; color: #fff; filter: drop-shadow(0 2px 6px rgba(0,0,0,.5)); }
.video__label { font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--gold); }

/* Newsletter */
.newsletter {
	margin: 56px 0; border: 1px solid var(--line); background: var(--card); padding: 32px;
	display: flex; flex-wrap: wrap; gap: 24px; align-items: center; justify-content: space-between;
}
.newsletter__copy, .newsletter__form { flex: 1 1 360px; }
.newsletter__title { font-size: 30px; margin-bottom: 6px; }
.newsletter__copy p { margin: 0; color: var(--muted); }

.empty-state { max-width: 640px; margin: 48px auto; text-align: center; }
.empty-state h1, .empty-state h2 { font-size: 34px; margin-bottom: 12px; }
.empty-state p { color: var(--muted); }
.empty-state .search-form { margin: 20px 0; }

/* ---------- Article ---------- */
.article { max-width: 760px; margin: 40px auto 0; }
.article__title { font-size: clamp(32px, 4.5vw, 48px); margin: 6px 0 14px; }
.article__dek { font-size: 20px; color: var(--muted); margin: 0 0 16px; font-family: var(--serif); }
.article__meta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.article__image { margin: 24px 0; }
.article__image figcaption { font-size: 13px; color: var(--muted); margin-top: 8px; }
.article__body { font-size: 18px; line-height: 1.7; }
.article__body p { margin: 0 0 1.2em; }
.entry-content p:empty { display: none; } /* empty paragraphs WordPress adds around shortcodes */
.article__body h2 { font-size: 28px; margin: 1.6em 0 .6em; }
.article__body h3 { font-size: 22px; margin: 1.4em 0 .5em; }
.article__body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.article__body blockquote { margin: 1.5em 0; padding: 4px 0 4px 20px; border-left: 4px solid var(--gold); font-family: var(--serif); font-size: 22px; }
.article__body img, .article__body figure { margin: 1.5em 0; }
.article__body figcaption, .wp-caption-text { font-size: 13px; color: var(--muted); }
.article__body ul, .article__body ol { padding-left: 1.4em; margin: 0 0 1.2em; }
.article__footer { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 16px; }
.alignwide { margin-left: -80px; margin-right: -80px; max-width: none; }
.alignfull { margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); max-width: 100vw; }
.aligncenter { margin-left: auto; margin-right: auto; }
.alignleft { float: left; margin: 0 1.5em 1em 0; }
.alignright { float: right; margin: 0 0 1em 1.5em; }

.share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.share__label { font-size: 13px; font-weight: 600; color: var(--muted); margin-right: 4px; }
.share__link { min-height: 40px; padding: 0 12px; border: 1px solid var(--line); background: transparent; color: var(--fg); font-size: 13px; display: inline-flex; align-items: center; }
.share__link:hover { border-color: var(--accent); text-decoration: none; }
.tags a { display: inline-block; margin: 0 8px 8px 0; padding: 9px 12px; background: var(--card); border: 1px solid var(--line); font-size: 13px; }

.related { max-width: var(--wrap); margin: 56px auto 0; }
.card-grid--3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.article-widgets { max-width: 760px; margin: 40px auto 0; }

.comments { max-width: 760px; margin: 48px auto 0; }
.comment-list { list-style: none; padding: 0; }
.comment-list .comment { padding: 16px 0; border-top: 1px solid var(--line); }
.comment-list .children { list-style: none; padding-left: 24px; }
.comment-form input[type="submit"] { min-height: 44px; padding: 0 20px; border: 0; background: var(--accent); color: var(--on-accent); font-weight: 600; }

/* ---------- Listings ---------- */
.listing { padding-top: 32px; }
.listing__header { border-bottom: 3px solid var(--fg); padding-bottom: 14px; margin-bottom: 28px; }
.listing__title { font-size: clamp(32px, 4vw, 44px); }
.listing__desc { color: var(--muted); margin-top: 8px; }
.listing__grid { display: flex; flex-wrap: wrap; gap: var(--gap); }
.listing__main { flex: 999 1 640px; min-width: 0; }
.listing__main .card-lead { margin-bottom: 36px; }
.listing__aside { flex: 1 1 300px; min-width: 0; }
.pagination, .navigation.pagination { margin: 40px 0; }
.nav-links { display: flex; flex-wrap: wrap; gap: 8px; }
.page-numbers { min-width: 44px; min-height: 44px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: var(--card); }
.page-numbers.current { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer { margin-top: 64px; background: var(--navy); color: var(--on-navy-muted); }
.footer__grid { display: flex; flex-wrap: wrap; gap: 32px; justify-content: space-between; padding-top: 40px; padding-bottom: 40px; }
.footer__brand { flex: 1 1 280px; }
.footer__brand p { font-size: 14px; margin: 10px 0 14px; max-width: 360px; }
.wordmark--footer .wordmark__text { font-size: 30px; }
.footer__col { flex: 0 1 180px; }
.footer__heading { font-family: var(--sans); font-size: 14px; font-weight: 600; color: var(--on-navy); margin-bottom: 10px; }
.footer__links, .social-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; font-size: 14px; }
.footer__links a, .social-links a { display: inline-block; padding: 9px 0; }
.social-links { flex-direction: row; flex-wrap: wrap; gap: 8px 16px; }
.site-footer a:hover { color: var(--on-navy); }
.footer__bottom { border-top: 1px solid var(--navy-line); padding-top: 16px; padding-bottom: 16px; font-size: 13px; }

/* Older browsers without aspect-ratio (iPhones before iOS 15) */
@supports not (aspect-ratio: 16 / 9) {
	.thumb, .video__thumb { position: relative; height: 0; padding-top: 56.25%; }
	.thumb img, .thumb__placeholder, .video__thumb img { position: absolute; inset: 0; top: 0; left: 0; }
}

/* ---------- Ads ---------- */
.ad { text-align: center; }
.ad__label { display: block; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.ad__unit + .ad__unit { margin-top: 12px; }
.ad img { display: inline-block; max-width: 100%; height: auto; }
.ad iframe, .ad ins { max-width: 100%; }
.ad--top { padding-top: 20px; }
.ad--sidebar { margin-bottom: 24px; }
.ad--home { margin: 48px 0 0; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ad--article { margin: 1.5em 0; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ad .widget_media_image figure, .ad figure { margin: 0; }

/* ---------- Small screens ---------- */
/* Tablets and phones: one-row header, logo left, buttons right */
@media (max-width: 960px) {
	.masthead { flex-wrap: nowrap; gap: 10px; padding-top: 12px; padding-bottom: 12px; }
	.masthead__date { display: none; }
	.masthead__brand { flex: 1 1 auto; min-width: 0; text-align: left; }
	.masthead__brand .custom-logo { max-height: 44px; margin: 0; }
	.masthead__actions { flex: 0 0 auto; gap: 8px; }
	.wordmark__text { font-size: 32px; }
}

@media (max-width: 720px) {
	:root { --gap: 24px; }
	.masthead { padding-top: 10px; padding-bottom: 10px; }
	.masthead__brand .custom-logo { max-height: 40px; }
	.masthead__actions { gap: 6px; }
	.wordmark { gap: 9px; }
	.wordmark__mark { width: 10px; height: 10px; }
	.wordmark__text { font-size: 26px; }
	.container { padding-left: 16px; padding-right: 16px; }

	.theme-toggle { width: 44px; padding: 0; }
	.theme-toggle__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
	.pill-button--gold { padding: 0 14px; font-size: 13px; }
	.primary-menu { gap: 4px 22px; }
	.primary-menu a { padding: 12px 0; }

	/* Breaking bar: one headline, max two lines */
	.breaking__inner { flex-wrap: nowrap; align-items: flex-start; gap: 10px; padding-top: 8px; padding-bottom: 8px; font-size: 13px; }
	.breaking__label { flex: 0 0 auto; font-size: 11px; padding: 3px 6px; margin-top: 1px; }
	.breaking__list { display: block; min-width: 0; }
	.breaking__list li + li { display: none; }
	.breaking__list a { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

	.front, .listing { padding-top: 20px; }
	.home__grid, .latest, .related { margin-top: 36px; }
	.card-lead__dek { font-size: 16px; }
	.section-head__title { font-size: 23px; }
	.videos, .newsletter { padding: 20px; }
	.videos { margin-left: -16px; margin-right: -16px; }
	.newsletter { margin: 40px 0; }
	.newsletter__title, .videos__title { font-size: 25px; }
	.inline-form .button { flex: 1 1 100%; }
	.alignwide { margin-left: 0; margin-right: 0; }
	.article { margin-top: 24px; }
	.article__body { font-size: 17px; }
	.article__dek { font-size: 18px; }
	.article__meta { flex-direction: column; align-items: flex-start; }
	.footer__grid { gap: 24px; padding-top: 32px; padding-bottom: 24px; }
	.footer__col { flex: 1 1 140px; }
}

@media (max-width: 360px) {
	.wordmark__mark { display: none; }
	.wordmark__text { font-size: 22px; }
	.pill-button--gold { padding: 0 10px; font-size: 12px; }
	.icon-button, .theme-toggle { width: 40px; min-height: 40px; }
	.masthead__actions { gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; }
}
