/*
Theme Name: The Blanchester Bugle
Theme URI: https://example.com/
Author: Kim West Communications
Description: A polished small-town community newspaper theme. Stories, community notices, a calendar of events, and managed advertising slots (leaderboard, roadblock, footer banner) are all driven by custom post types and custom fields.
Version: 1.0.0
Requires at least: 6.3
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: bugle
*/

/* ==========================================================================
   1. Tokens
   ========================================================================== */
:root {
	--ink: #14181f;
	--ink-soft: #414955;
	--muted: #6b7380;
	--paper: #fdfcf9;
	--paper-2: #f4f2ec;
	--silver: #c9ced6;
	--silver-2: #e7eaef;
	--blue: #4b9cd3;        /* Carolina blue */
	--blue-dark: #256a9b;   /* accessible blue for text/links */
	--navy: #0f1f33;

	--f-head: "Playfair Display", Georgia, "Times New Roman", serif;
	--f-body: "Source Serif 4", Georgia, "Times New Roman", serif;
	--f-ui: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

	--wrap: 1180px;
	--side: 360px;
}

/* ==========================================================================
   2. Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font: 400 1.0625rem/1.65 var(--f-body);
	-webkit-font-smoothing: antialiased;
}

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

a { color: var(--blue-dark); text-underline-offset: 0.18em; }
a:hover, a:focus { color: var(--ink); }

h1, h2, h3, h4 { font-family: var(--f-head); line-height: 1.15; margin: 0 0 0.5em; color: var(--ink); }

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

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	margin: -1px; padding: 0; border: 0;
	overflow: hidden; clip: rect(0 0 0 0);
	white-space: nowrap;
}
.skip-link:focus {
	position: fixed !important; top: 8px; left: 8px; z-index: 1000;
	width: auto; height: auto; clip: auto; margin: 0;
	padding: 0.75rem 1rem; background: var(--ink); color: #fff;
}

:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* ==========================================================================
   3. Masthead, dateline, navigation
   ========================================================================== */
.site-header { background: var(--paper); }

.masthead { margin: 0; padding: 1.25rem 0 0.25rem; text-align: center; font-size: 1rem; line-height: 0; }
.masthead a { display: inline-block; }
.masthead img { display: block; width: 100%; max-width: 900px; height: auto; margin: 0 auto; }

.edition {
	margin: 0.35rem 0 0.15rem;
	text-align: center;
	font: italic 600 1.4rem/1.2 var(--f-head);
	color: var(--blue-dark);
}

.dateline {
	display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
	margin-top: 0.4rem; padding: 0.5rem 0;
	border-top: 4px double var(--ink);
	border-bottom: 1px solid var(--ink);
	font: 600 0.78rem/1.2 var(--f-ui);
	letter-spacing: 0.14em; text-transform: uppercase;
}
.dateline span:nth-child(2) { text-align: center; }

.primary-nav { border-bottom: 1px solid var(--silver); }
.primary-nav ul { display: flex; flex-wrap: wrap; justify-content: center; list-style: none; margin: 0; padding: 0; }
.primary-nav a {
	display: block; padding: 0.85rem 1.15rem 0.7rem;
	font: 700 0.8rem/1 var(--f-ui); letter-spacing: 0.14em; text-transform: uppercase;
	color: var(--ink); text-decoration: none;
	border-bottom: 3px solid transparent;
}
.primary-nav a:hover,
.primary-nav .current-menu-item > a,
.primary-nav .current_page_item > a,
.primary-nav .current-menu-ancestor > a {
	color: var(--blue-dark); border-bottom-color: var(--blue);
}
.nav-toggle {
	display: none; width: 100%; padding: 0.8rem 0;
	background: none; border: 0; cursor: pointer;
	font: 700 0.8rem/1 var(--f-ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink);
}

/* ==========================================================================
   4. Layout
   ========================================================================== */
.site-content {
	display: grid;
	grid-template-columns: minmax(0, 1fr) var(--side);
	gap: 0 2.5rem;
	padding-top: 1.75rem; padding-bottom: 3rem;
}
.sidebar { border-left: 1px solid var(--silver); padding-left: 2.5rem; }

.section-title {
	position: relative;
	margin: 0 0 1rem; padding-top: 0.65rem;
	border-top: 3px solid var(--ink);
	font: 700 0.78rem/1 var(--f-ui); letter-spacing: 0.18em; text-transform: uppercase;
}
.section-title::before {
	content: ""; position: absolute; top: -3px; left: 0; width: 48px; height: 3px; background: var(--blue);
}
.section-title a { color: inherit; text-decoration: none; }
.section-block { margin-bottom: 2.25rem; }

.kicker {
	margin: 0.9rem 0 0.3rem;
	font: 700 0.72rem/1.2 var(--f-ui); letter-spacing: 0.16em; text-transform: uppercase;
	color: var(--blue-dark);
}
.meta { margin: 0; font: 400 0.85rem/1.4 var(--f-ui); color: var(--muted); }
.deck { margin: 0 0 0.75rem; font-style: italic; font-size: 1.15rem; line-height: 1.45; color: var(--ink-soft); }

/* ==========================================================================
   5. Front page
   ========================================================================== */
.lead { margin-bottom: 1.75rem; padding-bottom: 1.75rem; border-bottom: 1px solid var(--silver); }
.lead__image { display: block; }
.lead__image img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.lead__title { font-weight: 800; font-size: clamp(1.9rem, 3.6vw, 2.75rem); line-height: 1.08; margin-bottom: 0.5rem; }
.lead__title a { color: inherit; text-decoration: none; }
.lead__title a:hover { color: var(--blue-dark); }

.story-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.75rem 2rem; }
.story-card__image img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.story-card__title { font-weight: 700; font-size: 1.3rem; margin-bottom: 0.35rem; }
.story-card__title a { color: inherit; text-decoration: none; }
.story-card__title a:hover { color: var(--blue-dark); }
.story-card__excerpt { margin: 0.4rem 0 0; font-size: 0.97rem; line-height: 1.55; color: var(--ink-soft); }
.story-card { padding-top: 0.25rem; }

.notice-list { column-count: 2; column-gap: 2.25rem; column-rule: 1px solid var(--silver-2); }
.notice {
	break-inside: avoid; margin: 0 0 1.25rem; padding-bottom: 1.25rem;
	border-bottom: 1px dotted var(--silver);
	font-size: 0.97rem; line-height: 1.55;
}
.notice__org { margin: 0 0 0.1rem; font: 700 0.68rem/1.2 var(--f-ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--blue-dark); }
.notice__title { margin: 0 0 0.3rem; font-size: 1.15rem; font-weight: 700; }
.notice__title a { color: inherit; text-decoration: none; }
.notice__body > :last-child { margin-bottom: 0; }
.notice__body p { margin: 0 0 0.5rem; }
.notice__contact { margin: 0.5rem 0 0; font: 600 0.85rem/1.4 var(--f-ui); color: var(--ink-soft); white-space: pre-line; }
.notice--framed {
	padding: 1rem 1.1rem; border: 3px double var(--ink); background: var(--paper-2);
}

.pullquote {
	margin: 2.25rem 0 0; padding: 1.4rem 1rem; text-align: center;
	border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink);
}
.pullquote p { margin: 0; font: italic 500 1.4rem/1.35 var(--f-head); }
.pullquote cite { display: block; margin-top: 0.5rem; font: 600 0.78rem/1 var(--f-ui); letter-spacing: 0.14em; text-transform: uppercase; font-style: normal; color: var(--muted); }

.more-link { display: inline-block; margin-top: 0.9rem; font: 700 0.78rem/1 var(--f-ui); letter-spacing: 0.14em; text-transform: uppercase; }

/* ==========================================================================
   6. Sidebar: calendar + events
   ========================================================================== */
.sidebar .bugle-ad--roadblock { margin: 0 0 2rem; }
.widget { margin-bottom: 2.25rem; }

.bugle-cal { margin-bottom: 1.25rem; }
.bugle-cal__nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.bugle-cal__nav h3 { margin: 0; font-size: 1.15rem; font-weight: 700; }
.bugle-cal__nav a {
	display: grid; place-items: center; width: 2rem; height: 2rem;
	border: 1px solid var(--silver); border-radius: 50%;
	font: 700 1rem/1 var(--f-ui); text-decoration: none; color: var(--ink);
}
.bugle-cal__nav a:hover { background: var(--blue); border-color: var(--blue); color: #fff; }
.bugle-cal table { width: 100%; border-collapse: collapse; table-layout: fixed; font-family: var(--f-ui); }
.bugle-cal th { padding: 0.3rem 0; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; color: var(--muted); }
.bugle-cal abbr { text-decoration: none; }
.bugle-cal td { padding: 2px; text-align: center; font-size: 0.88rem; }
.bugle-cal td > span, .bugle-cal td > a {
	display: grid; place-items: center; height: 2.1rem; position: relative;
	text-decoration: none; color: var(--ink-soft);
}
.bugle-cal td.has-events > a { font-weight: 700; color: var(--ink); background: var(--silver-2); }
.bugle-cal td.has-events > a::after {
	content: ""; position: absolute; bottom: 3px; left: 50%; width: 4px; height: 4px; margin-left: -2px;
	border-radius: 50%; background: var(--blue-dark);
}
.bugle-cal td.has-events > a:hover { background: var(--blue); color: #fff; }
.bugle-cal td.is-today > span, .bugle-cal td.is-today > a { outline: 2px solid var(--blue); outline-offset: -2px; font-weight: 700; }

.bugle-events { list-style: none; margin: 0; padding: 0; }
.bugle-event { display: flex; gap: 0.85rem; padding: 0.8rem 0; border-top: 1px solid var(--silver-2); }
.bugle-event:first-child { border-top: 0; }
.bugle-event__badge {
	flex: 0 0 3.4rem; align-self: flex-start; text-align: center;
	border: 1px solid var(--silver); background: #fff; font-family: var(--f-ui);
}
.bugle-event__month { display: block; padding: 0.15rem 0; background: var(--blue); color: #fff; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.bugle-event__day { display: block; padding: 0.1rem 0 0.2rem; font: 800 1.5rem/1.1 var(--f-head); }
.bugle-event__title { display: block; font: 700 1.02rem/1.3 var(--f-head); color: var(--ink); text-decoration: none; }
.bugle-event__title:hover { color: var(--blue-dark); text-decoration: underline; }
.bugle-event__meta { margin: 0.15rem 0 0; font: 400 0.82rem/1.4 var(--f-ui); color: var(--muted); }
.empty-note { font: italic 0.95rem/1.4 var(--f-body); color: var(--muted); }

/* ==========================================================================
   7. Advertising slots
   ========================================================================== */
.bugle-ad { margin: 1.25rem auto; text-align: center; }
.bugle-ad__label {
	margin: 0 0 0.3rem;
	font: 600 0.6rem/1 var(--f-ui); letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted);
}
.bugle-ad__item { display: inline-block; max-width: 100%; line-height: 0; }
.bugle-ad__item img { display: block; max-width: 100%; height: auto; border: 1px solid var(--silver-2); }
.bugle-ad--leaderboard { max-width: 728px; margin-top: 1.25rem; margin-bottom: 0; }
.bugle-ad--footer { max-width: 728px; margin-top: 0; margin-bottom: 2.5rem; }
.bugle-ad--roadblock { max-width: 300px; }

/* ==========================================================================
   8. Single / page / archive
   ========================================================================== */
.entry__title { font-weight: 800; font-size: clamp(2rem, 4vw, 2.9rem); line-height: 1.08; }
.entry__header { margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--silver); }
.entry__image { margin: 0 0 1.5rem; }
.entry__image img { display: block; width: 100%; }
.entry__image figcaption { margin-top: 0.4rem; font: 400 0.82rem/1.4 var(--f-ui); color: var(--muted); }

.entry-content { font-size: 1.1rem; line-height: 1.7; }
.entry-content > * { max-width: 100%; }
.entry-content h2 { font-size: 1.7rem; margin-top: 1.8em; }
.entry-content h3 { font-size: 1.3rem; margin-top: 1.5em; }
.entry-content blockquote { margin: 1.5rem 0; padding: 0.25rem 0 0.25rem 1.25rem; border-left: 4px solid var(--blue); font-style: italic; color: var(--ink-soft); }
.entry-content figure { margin: 1.5rem 0; }
.entry-content figcaption { font: 400 0.82rem/1.4 var(--f-ui); color: var(--muted); }
.entry-content table { width: 100%; border-collapse: collapse; font: 400 0.95rem/1.4 var(--f-ui); }
.entry-content th, .entry-content td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--silver); text-align: left; }
.entry-content ul, .entry-content ol { padding-left: 1.4rem; }

.details {
	margin: 0 0 1.75rem; padding: 1rem 1.25rem;
	border: 3px double var(--ink); background: var(--paper-2);
	font-family: var(--f-ui);
}
.details dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1.25rem; margin: 0; }
.details dt { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--blue-dark); padding-top: 0.25rem; }
.details dd { margin: 0; font-size: 1rem; white-space: pre-line; }

.archive-header { margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--silver); }
.archive-header h1 { margin: 0; font-size: clamp(1.9rem, 3.5vw, 2.5rem); font-weight: 800; }
.archive-header p { margin: 0.4rem 0 0; color: var(--ink-soft); }

.list-nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin: 0.75rem 0 0; font: 700 0.78rem/1 var(--f-ui); letter-spacing: 0.12em; text-transform: uppercase; }

.day-group { margin-bottom: 1.75rem; }
.day-group__title { margin: 0 0 0.25rem; font: 700 1.2rem/1.2 var(--f-head); padding-bottom: 0.35rem; border-bottom: 2px solid var(--blue); }

.navigation.pagination { margin-top: 2rem; }
.nav-links { display: flex; flex-wrap: wrap; gap: 0.4rem; font-family: var(--f-ui); }
.page-numbers { padding: 0.4rem 0.8rem; border: 1px solid var(--silver); text-decoration: none; color: var(--ink); font-size: 0.9rem; }
.page-numbers.current, a.page-numbers:hover { background: var(--ink); border-color: var(--ink); color: #fff; }

.back-link { display: inline-block; margin-bottom: 1rem; font: 700 0.78rem/1 var(--f-ui); letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none; }

/* ==========================================================================
   9. Footer
   ========================================================================== */
.site-footer { margin-top: 1rem; background: var(--navy); color: #cdd5df; border-top: 5px solid var(--blue); font-family: var(--f-ui); }
.site-footer a { color: #fff; }
.site-footer a:hover { color: var(--blue); }
.footer-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem 3rem; padding-top: 2.5rem; padding-bottom: 2rem; }
.footer-grid h2 { margin: 0 0 0.75rem; font: 700 0.75rem/1 var(--f-ui); letter-spacing: 0.18em; text-transform: uppercase; color: var(--blue); }
.footer-grid p { margin: 0 0 0.6rem; font-size: 0.93rem; line-height: 1.55; }
.footer-grid strong { color: #fff; }
.footer-bar { border-top: 1px solid rgba(255, 255, 255, 0.12); }
.footer-bar .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; padding-top: 1rem; padding-bottom: 1rem; font-size: 0.8rem; }
.footer-bar ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; list-style: none; margin: 0; padding: 0; }

/* ==========================================================================
   10. Responsive
   ========================================================================== */
@media (max-width: 960px) {
	.site-content { grid-template-columns: minmax(0, 1fr); }
	.sidebar { border-left: 0; padding-left: 0; margin-top: 2.5rem; padding-top: 0.5rem; }
	.sidebar .bugle-ad--roadblock { margin-bottom: 2rem; }
	.footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 700px) {
	.wrap { padding: 0 16px; }
	.dateline { justify-content: center; text-align: center; font-size: 0.7rem; }
	.nav-toggle { display: block; }
	.primary-nav ul { display: none; flex-direction: column; border-top: 1px solid var(--silver); }
	.primary-nav.is-open ul { display: flex; }
	.primary-nav a { padding: 0.85rem 0.25rem; border-bottom: 1px solid var(--silver-2); }
	.story-grid { grid-template-columns: 1fr; }
	.notice-list { column-count: 1; }
	.footer-grid { grid-template-columns: 1fr; }
	.details dl { grid-template-columns: 1fr; gap: 0; }
	.details dd { margin-bottom: 0.6rem; }
}

/* ==========================================================================
   11. Print
   ========================================================================== */
@media print {
	.bugle-ad, .primary-nav, .site-footer, .nav-toggle, .sidebar .bugle-cal__nav { display: none !important; }
	.site-content { display: block; }
	.sidebar { border: 0; padding: 0; }
	body { background: #fff; }
}

/* ==========================================================================
   12. Event submission form
   ========================================================================== */
.bugle-form { max-width: 640px; font-family: var(--f-ui); }
.bugle-form fieldset { margin: 0 0 1.75rem; padding: 0; border: 0; }
.bugle-form legend { width: 100%; margin: 0 0 1rem; padding: 0.65rem 0 0; border-top: 3px solid var(--ink); font: 700 0.78rem/1 var(--f-ui); letter-spacing: 0.18em; text-transform: uppercase; }
.bugle-form__intro { margin: 0 0 1.5rem; font: 400 1.05rem/1.55 var(--f-body); color: var(--ink-soft); }
.bugle-form__hint { margin: -0.4rem 0 1rem; font-size: 0.88rem; color: var(--muted); }
.bugle-field { margin-bottom: 1rem; }
.bugle-field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.bugle-field label { display: block; margin-bottom: 0.3rem; font-weight: 600; font-size: 0.92rem; }
.bugle-field small { font-weight: 400; color: var(--muted); }
.bugle-field .req { color: var(--blue-dark); }
.bugle-field--check label { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; }
.bugle-form input[type="text"], .bugle-form input[type="email"], .bugle-form input[type="tel"],
.bugle-form input[type="date"], .bugle-form input[type="time"], .bugle-form textarea {
	width: 100%; padding: 0.65rem 0.75rem; border: 1px solid var(--silver); border-radius: 0;
	background: #fff; color: var(--ink); font: 400 1rem/1.4 var(--f-ui);
}
.bugle-form input:focus, .bugle-form textarea:focus { border-color: var(--blue); outline: 2px solid var(--blue); outline-offset: 0; }
.bugle-button {
	padding: 0.85rem 1.6rem; border: 0; background: var(--ink); color: #fff; cursor: pointer;
	font: 700 0.8rem/1 var(--f-ui); letter-spacing: 0.16em; text-transform: uppercase;
	border-bottom: 3px solid var(--blue);
}
.bugle-button:hover, .bugle-button:focus { background: var(--blue-dark); }
.bugle-form-message { margin: 0 0 1.5rem; padding: 1rem 1.25rem; border: 3px double var(--ink); background: var(--paper-2); font-family: var(--f-ui); }
.bugle-form-message p { margin: 0 0 0.5rem; }
.bugle-form-message p:last-child, .bugle-form-message ul { margin-bottom: 0; }
.bugle-form-message--error { border-color: #a4262c; }
.bugle-form-message ul { padding-left: 1.2rem; }
/* Honeypot: invisible to people, still in the DOM for bots. */
.bugle-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.submit-event { margin: 0.5rem 0 0; }
@media (max-width: 700px) { .bugle-field-row { grid-template-columns: 1fr; } }
