/*
Theme Name: Daily Libertarian
Theme URI: https://www.dailylibertarian.com
Description: Secure, modern replacement for the WP-Drudge theme used on dailylibertarian.com. Keeps the existing Posted Links and Static Links widgets, column sidebars and post fields, so the site carries over without re-entering content. Settings live in Appearance → Customize → Daily Libertarian.
Version: 2.5.0
Requires at least: 6.6
Requires PHP: 8.3
Author: Chance Haywood
Text Domain: dailylibertarian
*/

/* ---------- Base ---------- */
:root {
	--dl-ink: #121212;
	--dl-paper: #f4f1ea;
	--dl-card: #ffffff;
	--dl-gold: #f2b705;
	--dl-accent: #b34700;
	--dl-rule: #e6e1d6;
	--dl-muted: #6b665d;
	--dl-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
	/* Playfair Display for the name, headlines and section titles; Source Serif 4 for reading text. */
	--dl-sans: 'Source Serif 4', Georgia, 'Times New Roman', serif;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
	margin: 0;
	background: var(--dl-paper);
	color: var(--dl-ink);
	font-family: var(--dl-sans);
	font-size: 16px;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}

a { color: var(--dl-ink); }
a:hover, a:focus-visible { color: var(--dl-accent); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--dl-gold); outline-offset: 2px; }

img { max-width: 100%; height: auto; }

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

.skip-link:focus {
	clip: auto; width: auto; height: auto;
	position: fixed !important; top: 8px; left: 8px; z-index: 1000;
	background: #fff; padding: 8px 12px;
}

#wrapper {
	max-width: 1240px;
	margin: 0 auto;
	padding: 0 20px 40px;
}

/* ---------- Masthead (newspaper nameplate) ---------- */
#header {
	background: var(--dl-ink);
	/* Edge to edge on any screen width */
	margin: 0 calc(50% - 50vw);
	padding: 12px max(20px, calc(50vw - 600px)) 18px;
	text-align: center;
	border-bottom: 6px solid var(--dl-gold);
}

.dateline {
	display: flex;
	justify-content: space-between;
	gap: 6px 16px;
	flex-wrap: wrap;
	max-width: 1200px;
	margin: 0 auto 8px;
	color: #d8d3c8;
	font: 500 12px/1.4 var(--dl-sans);
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.site-branding-wrap {
	max-width: 1200px;
	margin: 0 auto;
	padding: 12px 0;
	border-top: 1px solid var(--dl-gold);
	border-bottom: 1px solid var(--dl-gold);
}

#logo-or-name {
	display: inline-block;
	font-family: var(--dl-serif);
	font-weight: 900;
	font-size: clamp(34px, 6.5vw, 80px);
	line-height: 1.05;
	letter-spacing: -0.01em;
	color: #fff;
	text-decoration: none;
}

#logo-or-name img { display: block; max-height: 140px; width: auto; margin: 0 auto; }

#tagline {
	margin: 12px 0 0;
	color: #d8d3c8;
	font-size: 15px;
	font-weight: 500;
	letter-spacing: 0.04em;
}

/* Tips line: right of the date on computers and tablets, under the name on phones */
.tip-line a { color: var(--dl-gold); text-decoration: none; text-transform: none; letter-spacing: 0.02em; font-weight: 600; }
.tip-line a:hover, .tip-line a:focus-visible { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.tip-line--phone { display: none; }

/* Optional header menu */
.header-nav {
	list-style: none;
	margin: 18px 0 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px 22px;
}

.header-nav a {
	color: #fff;
	text-decoration: none;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.header-nav a:hover { color: var(--dl-gold); }
.header-nav .sub-menu { display: none; }

/* ---------- Featured story ---------- */
#featured {
	margin: 32px auto 8px;
	max-width: 900px;
	text-align: center;
}

.featured-wrap + .featured-wrap { margin-top: 28px; }

.featured-wrap::before {
	content: attr(data-label);
	display: inline-block;
	margin-bottom: 14px;
	padding: 5px 12px;
	background: var(--dl-gold);
	color: var(--dl-ink);
	font: 800 12px/1 var(--dl-sans);
	letter-spacing: 0.14em;
	text-transform: uppercase;
	border-radius: 2px;
}

.featured-wrap[data-label=""]::before { display: none; }

#featured h2 {
	margin: 0;
	font-family: var(--dl-serif);
	font-weight: 800;
	font-size: clamp(28px, 4.2vw, 50px);
	line-height: 1.1;
}

#featured h2 a { color: var(--dl-ink); text-decoration: none; font: inherit; }
#featured h2 a:hover { color: var(--dl-accent); }

#featured .image-wrap { margin: 0 auto 18px; }
#featured .link-content { max-width: 680px; margin: 12px auto 0; color: var(--dl-muted); }
#featured .additional-links a { display: block; margin-top: 8px; font-weight: 600; }

/* ---------- Columns ---------- */
#main-content { margin-top: 28px; }

#content-wrap.columns {
	display: grid;
	grid-template-columns: repeat(var(--dl-cols, 3), minmax(0, 1fr));
	gap: 24px;
	align-items: start;
}

.link-col { min-width: 0; }

.widget-box {
	background: var(--dl-card);
	border: 1px solid var(--dl-rule);
	border-top: 4px solid var(--dl-ink);
	border-radius: 4px;
	padding: 18px 20px 8px;
	margin: 0 0 24px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.widget-head {
	position: relative;
	margin: 0 0 6px;
	padding: 0 0 12px;
	font: 800 19px/1.2 var(--dl-serif);
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.widget-head a { text-decoration: none; }

.widget-head::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	width: 36px;
	height: 3px;
	background: var(--dl-gold);
}

.widget-box ul { list-style: none; margin: 0; padding: 0; }

.widget-box li {
	padding: 12px 0;
	border-bottom: 1px solid var(--dl-rule);
}

.widget-box li:last-child { border-bottom: 0; }

.headline-link {
	font-family: var(--dl-serif);
	font-size: 15.5px;
	font-weight: 700;
	line-height: 1.4;
	text-decoration: none;
}

.headline-link:hover {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 3px;
}

.drudge_col_posts li:first-child .headline-link { font-size: 16.5px; font-weight: 800; }
.drudge_link_posts .headline-link { font-weight: 700; }

.additional-link { display: block; margin-top: 6px; font-size: 14px; font-weight: 500; }
.wpd_source_domain { color: var(--dl-muted); font-weight: 500; font-size: 0.85em; }
.post-date { margin: 4px 0 0; color: var(--dl-muted); font-size: 13px; }
.link-content { font-size: 14.5px; color: #333; }
.link-content p { margin: 6px 0 0; }
.link-list-image { margin: 8px 0; }
.link-list-image img { display: block; border-radius: 3px; }
.comment-link { font-size: 13px; }

.load-more-link { padding-bottom: 4px; }

.load-more {
	display: block;
	width: 100%;
	margin: 8px 0 12px;
	padding: 11px 14px;
	border: 0;
	border-radius: 3px;
	background: var(--dl-ink);
	color: #fff;
	font: 700 13px/1 var(--dl-sans);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s, color 0.15s;
}

.load-more:hover, .load-more:focus-visible { background: var(--dl-gold); color: var(--dl-ink); }
.load-more[aria-busy="true"] { opacity: 0.6; cursor: progress; }
.load-more-done { display: block; color: var(--dl-muted); font-size: 14px; text-align: center; padding: 6px 0 10px; }

/* ---------- Single posts, pages, archives ---------- */
.content-area {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 28px;
	margin-top: 32px;
}

.content-area.has-sidebar { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); }

.entry, .archive-list {
	background: var(--dl-card);
	border: 1px solid var(--dl-rule);
	border-top: 4px solid var(--dl-ink);
	border-radius: 4px;
	padding: 28px 32px;
}

.entry-title, .page-title {
	margin: 0 0 12px;
	font-family: var(--dl-serif);
	font-weight: 800;
	font-size: clamp(28px, 4vw, 42px);
	line-height: 1.12;
}

.entry-meta { color: var(--dl-muted); font-size: 14px; margin: 0 0 18px; }

.external-link a {
	display: inline-block;
	padding: 10px 16px;
	background: var(--dl-gold);
	color: var(--dl-ink);
	font-weight: 800;
	text-decoration: none;
	border-radius: 3px;
}

.external-link a:hover { background: var(--dl-ink); color: #fff; }

.entry-content { font-size: 17px; line-height: 1.7; }
.entry-content a { color: var(--dl-accent); }
.entry-content blockquote { margin: 1.4em 0; padding-left: 18px; border-left: 4px solid var(--dl-gold); color: #333; }

.archive-list ul { list-style: none; margin: 0; padding: 0; }
.archive-list li { padding: 14px 0; border-bottom: 1px solid var(--dl-rule); }
.archive-list li:last-child { border-bottom: 0; }

.pagination { margin-top: 20px; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 8px; }
.pagination a, .pagination span {
	padding: 6px 12px; border: 1px solid var(--dl-rule); border-radius: 3px;
	background: #fff; text-decoration: none; font-weight: 600;
}
.pagination .current { background: var(--dl-ink); color: #fff; border-color: var(--dl-ink); }

.home-link { margin: 24px 0 0; font-weight: 700; }

/* Comments */
.comments-area { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--dl-rule); }
.comment-list { list-style: none; padding: 0; }
.comment-list .children { list-style: none; padding-left: 20px; border-left: 2px solid var(--dl-rule); }
.comment-body { padding: 12px 0; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"],
.comment-form textarea, .search-field {
	width: 100%; padding: 10px 12px; border: 1px solid var(--dl-rule); border-radius: 3px; font: inherit; background: #fff;
}
.comment-form .submit, .search-submit {
	padding: 10px 18px; border: 0; border-radius: 3px; background: var(--dl-ink); color: #fff; font-weight: 700; cursor: pointer;
}
.search-form { display: flex; gap: 8px; }

/* ---------- Footer ---------- */
#footer {
	margin: 16px calc(50% - 50vw) -40px;
	padding: 28px max(20px, calc(50vw - 600px));
	background: var(--dl-ink);
	color: #d8d3c8;
	text-align: center;
	border-top: 6px solid var(--dl-gold);
	font-size: 13px;
	letter-spacing: 0.06em;
}

#footer a { color: #d8d3c8; text-decoration: none; text-transform: uppercase; font-weight: 500; }
#footer a:hover { color: var(--dl-gold); }
#footer p { margin: 6px 0; }
.footer-navigation { list-style: none; margin: 10px 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; }

/* ---------- Tablet & phone ---------- */
html, body { overflow-x: clip; }

/* Tablet and phone: sections follow their "Position on phones" setting;
   any without one keep their place, with column 2 (Top Headlines) first. */
@media (max-width: 999px) {
	#content-wrap.columns > .link-col { display: contents; }
	#content-wrap.columns .widget-box { order: var(--dl-phone-order, 200); margin: 0; min-width: 0; }
	#content-wrap.columns #column-2 .widget-box { order: var(--dl-phone-order, 100); }
	.content-area.has-sidebar { grid-template-columns: minmax(0, 1fr); }
}

/* Tablet: Top Headlines across the top, the rest in two even columns */
@media (min-width: 641px) and (max-width: 999px) {
	#content-wrap.columns { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: stretch; }
	#content-wrap.columns #column-2 .widget-box:first-child { grid-column: 1 / -1; }
}

/* Phone: one full-width column */
@media (max-width: 640px) {
	#content-wrap.columns { display: flex; flex-direction: column; align-items: stretch; gap: 20px; }
	#content-wrap.columns .widget-box { width: 100%; }
}

@media (max-width: 560px) {
	#wrapper { padding: 0 14px 32px; }
	#header { padding: 10px 14px 14px; }
	.dateline { justify-content: center; font-size: 11px; }
	.dateline-text { display: none; }
	.tip-line--phone {
		display: block;
		margin: 10px 0 0;
		color: #d8d3c8;
		font: 500 12px/1.4 var(--dl-sans);
		letter-spacing: 0.08em;
		text-transform: uppercase;
	}
	.tip-line--phone a { font-size: 13px; }
	.site-branding-wrap { padding: 8px 0; }
	#footer { margin-bottom: -32px; padding-left: 14px; padding-right: 14px; }
	.widget-box { padding: 16px 16px 6px; }
	.headline-link { font-size: 16px; }
	.widget-head { font-size: 18px; }
	.entry, .archive-list { padding: 20px 18px; }
}

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