/*
Theme Name: Scottish Borders Greens
Theme URI: https://bordersgreens.scot/
Author: Scottish Borders Greens
Description: Branch theme for the Scottish Borders Greens. Full-screen snap-scrolling homepage (Home, Council Elections, Branch News, Local Issues, About, Contact) with section dots, a built-in contact form, newsletter sign-up pop-up (sign-ups stored in WordPress with CSV export), Branch News post template and information page templates. Homepage text is edited under Appearance → Customise → Homepage sections. Responsive for desktop, tablet and mobile.
Version: 1.8.0
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: sbg
Tags: one-column, custom-menu, featured-images, threaded-comments, translation-ready, accessibility-ready, editor-style
*/

/* =========================================================
   1. Tokens
   ========================================================= */
:root {
	--green: #009a57;
	--green-mid: #007252;
	--dark: #052730;
	--light: #d8efe7;
	--off-white: #fffef7;
	--pink: #e5005c;
	--pink-dark: #c40050;
	--blue: #006fbb;
	--pale-yellow: #fff9c5;
	--news-bg: #124854;   /* Branch News: a lighter deep teal */
	--events-bg: #0b5c3c; /* Events: deep forest green */

	--header-h: 72px;
	--adminbar: 0px;
	--hh: calc(var(--header-h) + env(safe-area-inset-top, 0px));
	--top: calc(var(--hh) + var(--adminbar));
	--gutter: 28px;
	--rail-space: 0px;

	--ease: cubic-bezier(.22, .61, .36, 1);
	--fade: .25s var(--ease);

	--font-body: "Asap", system-ui, sans-serif;
	--font-head: "Asap Condensed", "Arial Narrow", sans-serif;
}

/* =========================================================
   2. Base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

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

body {
	background: var(--off-white);
	color: var(--dark);
	font-family: var(--font-body);
	font-weight: 400;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
	padding-top: var(--hh);
}

h1, h2, h3, h4 {
	font-family: var(--font-head);
	font-weight: 800;
	line-height: .98;
	letter-spacing: .2px;
}
h1, h2 { text-transform: uppercase; }

a { color: inherit; text-decoration: none; }
img, svg, video { max-width: 100%; height: auto; display: block; }
ul.menu { list-style: none; }
button, input, textarea, select { font: inherit; color: inherit; }

.wrap {
	width: 100%;
	max-width: calc(1080px + 2 * var(--gutter));
	margin: 0 auto;
	padding: 0 var(--gutter);
}
.logo-mark { width: 1em; height: 1em; display: inline-block; flex: none; }

.screen-reader-text,
.cf-hp {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}
.skip-link {
	position: fixed; left: 12px; top: -60px; z-index: 100;
	background: var(--pale-yellow); color: var(--dark);
	padding: 10px 16px; border-radius: 8px; font-weight: 700;
	transition: top var(--fade);
}
.skip-link:focus { top: 12px; }

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

/* =========================================================
   3. Buttons & links (all with a soft fade)
   ========================================================= */
.btn {
	display: inline-block;
	font-family: var(--font-head);
	font-size: 17px;
	font-weight: 700;
	line-height: 1.2;
	padding: 12px 22px;
	border-radius: 8px;
	border: 2px solid transparent;
	cursor: pointer;
	transition: background-color var(--fade), color var(--fade), border-color var(--fade), transform var(--fade), box-shadow var(--fade);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-dark { background: var(--dark); color: #fff; }
.btn-dark:hover, .btn-dark:focus-visible { background: #000; }
.btn-pink { background: var(--pink); color: #fff; }
.btn-pink:hover, .btn-pink:focus-visible { background: var(--pink-dark); }
.btn-outline { background: transparent; color: var(--off-white); border-color: var(--off-white); }
.btn-outline:hover, .btn-outline:focus-visible { background: var(--off-white); color: var(--green-mid); }
.btn-green { background: var(--green-mid); color: #fff; }
.btn-green:hover, .btn-green:focus-visible { background: var(--dark); }

.text-link {
	font-weight: 700;
	font-size: 16px;
	border-bottom: 2px solid currentColor;
	transition: color var(--fade), border-color var(--fade), opacity var(--fade);
}
.text-link:hover, .text-link:focus-visible { opacity: .75; }

html.sbg-flow body { display: flex; flex-direction: column; min-height: 100vh; }
html.sbg-flow main { flex: 1 0 auto; }

/* =========================================================
   4. Header + navigation
   ========================================================= */
.site-header {
	position: fixed; top: 0; left: 0; right: 0; z-index: 60;
	height: var(--hh);
	padding-top: env(safe-area-inset-top, 0px);
	background: var(--green-mid);
	border-bottom: 1px solid rgba(5, 39, 48, .55);
	box-shadow: 0 4px 16px -4px rgba(5, 39, 48, .35);
}
html:has(> body.admin-bar) { --adminbar: 32px; }
.admin-bar .site-header { top: var(--adminbar); }
@media (max-width: 782px) { html:has(> body.admin-bar) { --adminbar: 46px; } }

.header-row {
	height: var(--header-h);
	display: flex; align-items: center; justify-content: space-between;
	gap: 20px;
	padding: 0 var(--gutter);
	max-width: 1440px; margin: 0 auto;
}
.brand {
	display: flex; align-items: center; gap: 10px;
	font-family: var(--font-head);
	font-size: 21px; font-weight: 800; color: #fff;
	white-space: nowrap;
}
.brand { --badge: 88px; align-self: flex-start; margin-top: 8px; gap: 14px; }
/* The party mark sits on a round badge that hangs below the header bar. */
.brand-badge {
	flex: none;
	display: grid; place-items: center;
	width: var(--badge); height: var(--badge);
	border-radius: 50%;
	background: var(--green-mid);
	border: 1px solid rgba(5, 39, 48, .55);
	box-shadow: 0 4px 16px -4px rgba(5, 39, 48, .45);
	/* Keep the badge on its own layer at all times, so it doesn't
	   re-snap (and shift sideways) when the twist finishes. */
	transform: rotate(0deg) translateZ(0);
	backface-visibility: hidden;
	will-change: transform;
	transition: transform .35s var(--ease), background-color .3s var(--ease);
}
.brand .logo-mark { width: 84%; height: 84%; color: #fff; transition: color .3s var(--ease); }
.brand-name { margin-top: calc((var(--header-h) - 8px - 21px) / 2 - 2px); align-self: flex-start; line-height: 1; transition: color var(--fade); }
.brand:hover .brand-badge, .brand:focus-visible .brand-badge { transform: rotate(-6deg) translateZ(0); background: #fff; }
.brand:hover .logo-mark, .brand:focus-visible .logo-mark { color: var(--green); }
.brand:hover .brand-name { color: #dff3ea; }
.site-header { overflow: visible; }

.site-nav .menu { display: flex; gap: 22px; flex-wrap: nowrap; }
.site-nav a {
	position: relative;
	display: block;
	font-family: var(--font-head);
	font-size: 16px; font-weight: 700;
	color: #dff3ea;
	padding: 6px 0;
	white-space: nowrap;
	transition: color var(--fade);
}
.site-nav a::after {
	content: "";
	position: absolute; left: 0; right: 0; bottom: 0;
	height: 2px; background: var(--pale-yellow);
	opacity: 0; transform: scaleX(.6);
	transition: opacity var(--fade), transform var(--fade);
}
.site-nav a:hover, .site-nav a:focus-visible,
.site-nav a.current, .site-nav a.is-active { color: #fff; outline: none; }
.site-nav a:hover::after, .site-nav a:focus-visible::after,
.site-nav a.current::after, .site-nav a.is-active::after { opacity: 1; transform: scaleX(1); }

.menu-toggle {
	display: none;
	width: 44px; height: 44px;
	margin-right: -8px;
	background: none; border: 0; border-radius: 8px;
	cursor: pointer; color: #fff;
	transition: background-color var(--fade);
}
.menu-toggle:hover { background: rgba(255,255,255,.1); }
.menu-toggle .bars { position: relative; display: block; width: 24px; height: 16px; margin: 0 auto; }
.menu-toggle .bars span {
	position: absolute; left: 0; width: 100%; height: 2.5px; border-radius: 2px;
	background: currentColor;
	transition: transform .3s var(--ease), opacity .2s var(--ease), top .3s var(--ease);
}
.menu-toggle .bars span:nth-child(1) { top: 0; }
.menu-toggle .bars span:nth-child(2) { top: 6.75px; }
.menu-toggle .bars span:nth-child(3) { top: 13.5px; }
.nav-open .menu-toggle .bars span:nth-child(1) { top: 6.75px; transform: rotate(45deg); }
.nav-open .menu-toggle .bars span:nth-child(2) { opacity: 0; }
.nav-open .menu-toggle .bars span:nth-child(3) { top: 6.75px; transform: rotate(-45deg); }

.nav-scrim {
	position: fixed; inset: 0; z-index: 55;
	background: rgba(5, 39, 48, .45);
	opacity: 0; transition: opacity .3s var(--ease);
}
.nav-open .nav-scrim { opacity: 1; }

/* =========================================================
   5. Homepage: full-screen snap sections
   ========================================================= */
html.sbg-snap {
	scroll-snap-type: y mandatory;
	scroll-padding-top: var(--top);
	overscroll-behavior-y: none;
}
html.sbg-snap body { overflow-x: hidden; }

.snap-section {
	position: relative;
	/* Exactly one screen, minus the fixed header. */
	height: calc(100vh - var(--top));
	height: calc(100dvh - var(--top));
	scroll-snap-align: start;
	scroll-snap-stop: always;
	overflow: hidden;               /* content can never spill into the next section */
	padding: clamp(24px, 5.5vh, 64px) 0 clamp(24px, 5vh, 56px);
	--rail-space: 44px;
}
.snap-section > .section-inner {
	padding-right: calc(var(--gutter) + var(--rail-space));
	padding-left: calc(var(--gutter) + var(--rail-space));
	transform-origin: top center;
	transform: scale(var(--fit, 1));
}
.snap-section h1, .snap-section h2 { font-size: clamp(32px, min(4.4vw, 6.4vh), 54px); }

/* Content fades up as each section arrives (only when JS is running). */
.js .snap-section .section-inner > * {
	opacity: 0;
	transform: translateY(14px);
	transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.js .snap-section.is-visible .section-inner > * { opacity: 1; transform: none; }
.js .snap-section.is-visible .section-inner > *:nth-child(2) { transition-delay: .08s; }
.js .snap-section.is-visible .section-inner > *:nth-child(3) { transition-delay: .16s; }
.js .snap-section.is-visible .section-inner > *:nth-child(4) { transition-delay: .24s; }

.section-head {
	display: flex; align-items: baseline; justify-content: space-between;
	gap: 12px 20px; flex-wrap: wrap;
	margin-bottom: clamp(18px, 3.5vh, 30px);
}

/* ---- Home ---- */
#home { background: var(--light); color: var(--dark); }
.hero-photo {
	/* Letterbox strip whose depth follows the screen height, so the
	   homepage still fits one screen. */
	height: clamp(110px, 24vh, 300px);
	margin-bottom: clamp(16px, 3vh, 28px);
	border: 3px solid var(--dark); border-radius: 10px;
	overflow: hidden;
	background: var(--green-mid);
}
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }
.hero-copy { text-align: center; }
.lede { font-size: clamp(16px, 2.1vh, 18px); margin: 14px auto 0; color: #1c433d; max-width: 80%; }
.involve-panel {
	display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
	margin-top: clamp(20px, 4.5vh, 40px);
}
.involve-card {
	border-radius: 10px;
	padding: clamp(18px, 3.2vh, 28px) 24px;
	color: #fff;
	transition: transform var(--fade), box-shadow var(--fade);
}
.involve-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -12px rgba(5,39,48,.45); }
.involve-card.donate { background: var(--pink); }
.involve-card.volunteer { background: var(--green-mid); }
.involve-card.newsletter { background: var(--blue); }
.involve-panel.has-3 { grid-template-columns: repeat(3, 1fr); }
.involve-panel.has-3 .involve-card { display: flex; flex-direction: column; align-items: center; text-align: center; }
.involve-panel.has-3 .involve-card p { margin-left: auto; margin-right: auto; }
.involve-panel.has-3 .involve-card .btn { margin-top: auto; align-self: center; }
.involve-card.support { background: var(--green-mid); }
.involve-card h3 { font-size: 25px; text-transform: uppercase; margin-bottom: 8px; }
.involve-card p { font-size: 15px; max-width: 40ch; margin-bottom: 16px; }

/* ---- Elections ---- */
#campaigns { background: var(--green); color: #fff; }
/* Our Campaigns: one big card on the left, four smaller ones on the right.
   Height follows the screen so the section always fits. */
.news-grid.campaign-grid {
	grid-template-columns: repeat(3, 1fr);
	grid-template-rows: 1fr 1fr;
	gap: 18px;
	height: clamp(300px, calc(100dvh - var(--top) - 190px), 600px);
}
.campaign-grid > .news-card { min-height: 0; }
.campaign-grid .news-thumb { flex: 1 1 auto; min-height: 0; aspect-ratio: auto; }
.campaign-grid .news-body { flex: none; padding: 12px 16px 14px; }
.campaign-grid .news-body h3 { font-size: 18px; }
.campaign-grid .news-body p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; }
/* Featured campaign: two columns wide in the top-left, photo beside the text */
.campaign-grid > .lead { grid-column: span 2; flex-direction: row; }
.campaign-grid .lead .news-thumb { flex: 0 0 56%; }
.campaign-grid .lead .news-body { flex: 1 1 auto; align-self: center; padding: 20px 24px; }
.campaign-grid .lead .news-body h3 { font-size: 26px; text-transform: uppercase; margin-bottom: 10px; }
.campaign-grid .lead .news-body p { -webkit-line-clamp: 5; font-size: 15px; }
.news-card.campaign-all {
	background: var(--pink); color: #fff;
	justify-content: center; align-items: center; text-align: center;
	padding: 18px;
	outline-color: transparent;
}
.news-card.campaign-all:hover { outline-color: #fff; }
.campaign-all h3 { font-size: 22px; text-transform: uppercase; margin-bottom: 8px; }
.campaign-all p { font-size: 14px; color: #ffe1ec; margin-bottom: 14px; max-width: 30ch; }
/* Fewer than four current campaigns */
.campaign-grid.count-1 { grid-template-rows: 1fr; }
.campaign-grid.count-2 .campaign-all { grid-column: 1 / -1; }
.campaign-grid.count-3 .campaign-all { grid-column: span 2; }
@media (max-height: 700px) and (min-width: 641px) {
	.campaign-grid .news-body p { display: none; }
	.campaign-grid .lead .news-body p { display: -webkit-box; -webkit-line-clamp: 3; }
	.campaign-all p { display: none; }
}
#campaigns .section-head .text-link { color: var(--pale-yellow); }
#campaigns .swipe-dots span { background: rgba(255,255,255,.4); }
#campaigns .swipe-dots span.on { background: var(--pale-yellow); }
#elections { background: var(--green); color: #fff; }
.elections-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; align-items: start; }
#elections h2 { margin-bottom: 14px; }
.elections-text { font-size: 17px; max-width: 46ch; color: #eafff3; }
.cta-row { display: flex; gap: 14px; margin-top: clamp(18px, 3.5vh, 28px); flex-wrap: wrap; }
.elect-card { background: var(--dark); border-radius: 10px; padding: 24px; color: #fff; }
.elect-card h3 { font-size: 14px; letter-spacing: .4px; text-transform: uppercase; color: var(--green); margin-bottom: 6px; }
.elect-card p { color: #cfe9e0; font-size: 15px; margin-bottom: 14px; }
.elect-card .text-link { color: var(--pale-yellow); font-size: 15px; }

/* ---- News (cards shared with listings) ---- */
#news { background: var(--news-bg); color: #fff; }
/* Homepage news: six cards, 16:9 photo, date + headline only.
   The grid narrows on short screens so two rows always fit. */
.news-grid.home-news {
	grid-template-columns: repeat(3, 1fr);
	gap: 18px 20px;
	max-width: min(100%, calc((100dvh - var(--top) - 320px) * 2.6 + 40px));
	margin: 0 auto;
}
.post-card .news-thumb { aspect-ratio: 16 / 9; }
.post-card .news-body { padding: 10px 14px 12px; }
.card-date { display: block; font-size: 12px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: var(--green-mid); margin-bottom: 4px; }
.post-card .news-body h3 { font-size: 17px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#news .section-head .text-link { color: var(--green); }
.news-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.news-card {
	display: flex; flex-direction: column;
	border-radius: 10px; overflow: hidden;
	background: #fff; color: var(--dark);
	outline: 2px solid transparent; outline-offset: 2px;
	transition: outline-color var(--fade), transform var(--fade), box-shadow var(--fade);
}
.news-card:hover, .news-card:focus-visible {
	outline-color: var(--green);
	transform: translateY(-3px);
	box-shadow: 0 14px 30px -16px rgba(0,0,0,.5);
}
.news-thumb {
	aspect-ratio: 16 / 10;
	background: linear-gradient(135deg, var(--light), var(--green));
	overflow: hidden;
}
.news-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.news-card:hover .news-thumb img { transform: scale(1.04); }
.news-body { padding: 16px 18px 18px; }
.tag {
	display: inline-block;
	font-weight: 800; font-size: 11px; letter-spacing: .4px; text-transform: uppercase;
	background: var(--pale-yellow); color: var(--dark);
	padding: 3px 9px; border-radius: 999px; margin-bottom: 8px;
}
.news-body h3 { font-size: 19px; line-height: 1.1; margin-bottom: 6px; }
.news-body p { font-size: 14px; line-height: 1.45; color: #3c4f4a; }
.swipe-dots { display: none; }

/* ---- Issues ---- */
#issues { background: var(--light); color: var(--dark); }
#issues .section-head .text-link { color: var(--green-mid); }
.issues-grid {
	display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
	background: var(--dark); border: 2px solid var(--dark); border-radius: 10px; overflow: hidden;
}
/* Local issues: one card per child page of the Local Issues page */
.issue-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.news-card.text-card { background: #fff; border: 2px solid var(--dark); }
.news-card.text-card .news-body { padding: 18px 18px 20px; }
.news-card.text-card h3 { font-size: 19px; text-transform: uppercase; color: var(--green-mid); margin-bottom: 8px; line-height: 1.05; }
.news-card.text-card p { font-size: 14px; color: #173a37; }
#issues .swipe-dots span { background: rgba(5,39,48,.25); }
#issues .swipe-dots span.on { background: var(--green-mid); }
.issue { background: var(--light); padding: 22px 20px; transition: background-color var(--fade); }
.issue:hover { background: #e6f6f0; }
.issue h3 { font-size: 21px; text-transform: uppercase; color: var(--green-mid); margin-bottom: 8px; }
.issue p { font-size: 15px; color: #173a37; }

/* ---- About ---- */
#about { background: var(--off-white); color: var(--dark); }
.about-text p { font-size: clamp(16px, 2.2vh, 19px); max-width: none; margin-bottom: 14px; }
#about .btn { margin-top: 10px; }

/* ---- Contact + footer ---- */
#contact { background: var(--dark); color: var(--off-white); }
.cf-heading { margin-bottom: clamp(14px, 3vh, 24px); }
.contact-form {
	display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 18px;
	max-width: 720px;
	margin-bottom: clamp(22px, 5vh, 44px);
}
.cf-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cf-field input, .cf-field textarea { width: 100%; min-width: 0; }
.cf-field.full { grid-column: 1 / -1; }
.cf-field label { font-size: 13px; font-weight: 700; color: var(--green); letter-spacing: .2px; }
.cf-field input, .cf-field textarea {
	font-size: 15px; color: var(--dark); background: var(--off-white);
	border: 2px solid transparent; border-radius: 8px; padding: 10px 12px; resize: vertical;
	transition: border-color var(--fade), box-shadow var(--fade);
}
.cf-field textarea { min-height: 88px; max-height: 30vh; }
.cf-field input:focus, .cf-field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,111,187,.35); }
.cf-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.cf-submit { background: var(--pink); color: #fff; border: 0; }
.cf-submit:hover, .cf-submit:focus-visible { background: var(--pink-dark); }
.cf-submit[disabled] { opacity: .6; cursor: progress; }
.cf-status { font-weight: 700; color: var(--green); transition: opacity var(--fade); }
.cf-status.is-error { color: #ff9ab8; }

/* Footer (inner pages + homepage contact section) */
.site-footer { background: var(--dark); color: var(--off-white); padding: 44px 0 28px; }
.site-footer.in-section { padding: 0; background: none; }
.foot-grid {
	display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 28px;
	margin-bottom: 22px;
}
.in-section .foot-grid { border-top: 1px solid #1c4048; padding-top: clamp(20px, 3.5vh, 32px); }
.site-footer h4 { font-size: 15px; text-transform: uppercase; color: var(--green); margin-bottom: 10px; }
.site-footer p, .site-footer a { font-size: 14px; color: #cfe9e0; }
.foot-about p { margin-top: 14px; max-width: 34ch; }
.site-footer .menu li { margin-bottom: 6px; }
.site-footer .menu a { transition: color var(--fade), opacity var(--fade); border-bottom: 1px solid transparent; }
.site-footer .menu a:hover, .site-footer .menu a:focus-visible { color: #fff; border-bottom-color: currentColor; }
.foot-logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 800; font-size: 17px; color: #fff !important; }
.foot-logo .logo-mark { width: 24px; height: 24px; color: var(--green); }
.foot-logo .logo-mark.foot-mark { width: clamp(84px, 15vh, 150px); height: auto; aspect-ratio: 1; color: var(--green); transition: color var(--fade), transform var(--fade); }
.foot-logo:hover .logo-mark.foot-mark { color: #fff; transform: rotate(-6deg); }
.foot-bottom {
	border-top: 1px solid #1c4048; padding-top: 16px;
	font-size: 12px; color: #7fa39c;
	display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px;
}

/* =========================================================
   6. Section dots (right-hand rail)
   ========================================================= */
.rail {
	position: fixed; right: 18px; top: calc(50% + var(--top) / 2); z-index: 40;
	transform: translateY(-50%);
	display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
}
.rail a {
	position: relative;
	display: flex; align-items: center; justify-content: center;
	width: 24px; height: 24px;
}
.rail .dot {
	display: block; width: 10px; height: 10px; border-radius: 50%;
	background: var(--dark);
	box-shadow: 0 0 0 2px rgba(255,255,255,.6);
	opacity: .5;
	transition: background-color .3s var(--ease), opacity .3s var(--ease), transform .3s var(--ease), box-shadow .3s var(--ease);
}
.rail.on-dark .dot { background: var(--off-white); box-shadow: 0 0 0 2px rgba(5,39,48,.5); }
.rail a:hover .dot { opacity: .9; transform: scale(1.2); }
.rail a.active .dot { background: var(--blue); opacity: 1; transform: scale(1.3); box-shadow: 0 0 0 2px rgba(255,255,255,.9); }
.rail-label {
	position: absolute; right: 30px; top: 50%;
	transform: translate(6px, -50%);
	white-space: nowrap;
	font-family: var(--font-head); font-weight: 700; font-size: 14px;
	background: var(--dark); color: #fff;
	padding: 4px 10px; border-radius: 6px;
	opacity: 0; pointer-events: none;
	transition: opacity var(--fade), transform var(--fade);
}
.rail a:hover .rail-label, .rail a:focus-visible .rail-label { opacity: 1; transform: translate(0, -50%); }

/* =========================================================
   7. Inner pages: title bands, posts, listings
   ========================================================= */
.titleband { background: var(--green); color: #fff; padding: 44px 0; }
.titleband h1, .postband h1 { font-size: clamp(32px, 4.4vw, 50px); }
.crumb { font-size: 14px; font-weight: 700; color: #eafff3; margin-bottom: 10px; }
.crumb a { border-bottom: 1px solid rgba(255,255,255,.5); transition: border-color var(--fade), color var(--fade); }
.crumb a:hover { border-bottom-color: #fff; color: #fff; }

.postband { background: var(--news-bg); color: #fff; padding: 44px 0 72px; }
/* "BRANCH NEWS" sits where every page's title sits; the headline is one size down */
.band-label { font-family: var(--font-head); font-weight: 800; text-transform: uppercase; line-height: .98; font-size: clamp(32px, 4.4vw, 50px); margin-bottom: 12px; }
.band-label a { color: inherit; }
.postband h1.post-title, .titleband h1.post-title { font-size: clamp(24px, 3vw, 34px); text-transform: none; line-height: 1.08; margin-bottom: 12px; }
/* News archive: same colours as the homepage Branch News section */
.news-archive { background: var(--news-bg); color: #fff; }
.newsband { background: var(--news-bg); padding: 44px 0 8px; }
.newsband h1 { font-size: clamp(32px, 4.4vw, 50px); }
.news-archive .listing { padding-top: 28px; }
.news-archive .listing .news-card { border: 0; }
.news-archive .empty-note { color: #d6ece6; }
.news-archive .pagination .page-numbers { background: rgba(255,255,255,.12); color: #fff; }
.news-archive .pagination .page-numbers.current, .news-archive .pagination a.page-numbers:hover { background: var(--green); color: #fff; }
.postband .crumb { color: #9fc9bf; }
.postband .crumb a { border-bottom-color: rgba(255,255,255,.4); }
.postband .tag { font-size: 12px; padding: 4px 11px; margin-bottom: 14px; }
.postband h1 { margin-bottom: 14px; }
.meta { font-size: 14px; color: #9fc9bf; }

.featured {
	max-width: 1024px; margin: -40px auto 0;
	aspect-ratio: 21 / 8;
	border-radius: 10px; overflow: hidden;
	background: linear-gradient(135deg, var(--light), var(--green));
	position: relative;
}
.featured img { width: 100%; height: 100%; object-fit: cover; }

.entry-content { padding-top: 48px; padding-bottom: 64px; }
.post-article .entry-content { padding-top: 44px; }
.entry-content.content-narrow { max-width: calc(760px + 2 * var(--gutter)); }
.entry-content > * + * { margin-top: 18px; }
.entry-content p, .entry-content li { font-size: 17px; line-height: 1.6; }
.entry-content h2 { font-size: 24px; margin-top: 38px; }
.post-article .entry-content h2 { font-size: 23px; text-transform: none; color: var(--green-mid); }
.entry-content h3 { font-size: 20px; margin-top: 30px; }
.entry-content h2 + *, .entry-content h3 + * { margin-top: 12px; }
.entry-content a:not(.btn):not(.wp-block-button__link):not(.back-link) {
	color: var(--green-mid); text-decoration: underline; text-underline-offset: 2px;
	transition: color var(--fade);
}
.entry-content a:not(.btn):not(.wp-block-button__link):not(.back-link):hover { color: var(--dark); }
.entry-content ul, .entry-content ol { padding-left: 22px; }
.entry-content li + li { margin-top: 8px; }
.entry-content blockquote, .entry-content .wp-block-quote, .entry-content .pullbar {
	border-left: 4px solid var(--green); background: var(--light);
	padding: 16px 20px; border-radius: 0 8px 8px 0;
	font-size: 17px; font-weight: 600;
	margin: 28px 0;
}
.entry-content blockquote p { font-weight: 600; }
.entry-content blockquote cite { display: block; margin-top: 8px; font-size: 14px; font-style: normal; font-weight: 400; }
.entry-content .wp-block-pullquote { border-top: 4px solid var(--green); border-bottom: 4px solid var(--green); padding: 24px 0; }
.entry-content .wp-block-pullquote blockquote { background: none; border: 0; font-family: var(--font-head); font-size: 26px; text-transform: uppercase; }
.entry-content img { border-radius: 8px; }
.entry-content figcaption { font-size: 14px; color: #3c4f4a; margin-top: 8px; }
.entry-content table { width: 100%; border-collapse: collapse; }
.entry-content th, .entry-content td { border-bottom: 1px solid #b9d9cd; padding: 10px 8px; text-align: left; }
.entry-content .alignwide { max-width: 1200px; margin-left: auto; margin-right: auto; }
.entry-content .alignfull { width: 100vw; max-width: 100vw; margin-left: calc(50% - 50vw); }
.entry-content .alignleft { float: left; margin: 6px 24px 12px 0; max-width: 50%; }
.entry-content .alignright { float: right; margin: 6px 0 12px 24px; max-width: 50%; }
.entry-content::after { content: ""; display: table; clear: both; }
.wp-block-button__link {
	font-family: var(--font-head); font-weight: 700; font-size: 17px;
	border-radius: 8px; padding: 12px 22px;
	background: var(--green-mid); color: #fff;
	transition: background-color var(--fade), color var(--fade);
}
.wp-block-button__link:hover { background: var(--dark); color: #fff; }
.is-style-outline .wp-block-button__link { background: none; border: 2px solid currentColor; color: var(--green-mid); }
.back-link {
	display: inline-block; margin-top: 30px;
	font-weight: 700; color: var(--green-mid);
	border-bottom: 2px solid var(--green);
	transition: color var(--fade), border-color var(--fade);
}
.back-link:hover { color: var(--dark); border-bottom-color: var(--dark); }

.related { background: var(--light); padding: 48px 0; }
.related h2 { font-size: 26px; margin-bottom: 24px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.news-card.highlight {
	background: var(--pink); align-items: center; justify-content: center;
	box-shadow: 0 0 0 2px var(--pink), 0 0 34px 6px rgba(229,0,92,.45);
}
.news-card.highlight:hover, .news-card.highlight:focus-visible { outline-color: #fff; box-shadow: 0 0 0 2px var(--pink), 0 0 44px 10px rgba(229,0,92,.55); }
.news-card.highlight .cta-inner { padding: 28px 22px; text-align: center; }
.news-card.highlight h3 { color: #fff; font-size: 22px; text-transform: uppercase; margin-bottom: 8px; }
.news-card.highlight p { color: #ffdbe9; font-size: 14px; }

.listing { padding: 48px 0 64px; }
.listing-grid { row-gap: 28px; }
.listing .news-card { border: 1px solid #cfe5dc; }
.pagination { margin-top: 36px; }
.pagination .nav-links { display: flex; gap: 8px; flex-wrap: wrap; }
.pagination .page-numbers {
	display: inline-block; min-width: 40px; text-align: center;
	padding: 8px 12px; border-radius: 8px; font-weight: 700;
	background: var(--light); color: var(--dark);
	transition: background-color var(--fade), color var(--fade);
}
.pagination .page-numbers.current, .pagination a.page-numbers:hover { background: var(--green-mid); color: #fff; }
.empty-note { font-size: 16px; opacity: .85; }

.search-form { display: flex; gap: 10px; max-width: 480px; }
.search-form label { flex: 1; }
.search-field { width: 100%; padding: 10px 12px; border: 2px solid #b9d9cd; border-radius: 8px; }
.search-submit { padding: 10px 18px; border: 0; border-radius: 8px; background: var(--green-mid); color: #fff; font-weight: 700; cursor: pointer; }

/* =========================================================
   8. Short desktop/laptop screens: tighten the homepage
   ========================================================= */
@media (min-width: 641px) and (max-height: 800px) {
	.involve-card p { margin-bottom: 12px; }
	.btn { padding: 10px 18px; font-size: 16px; }
	.news-thumb { aspect-ratio: 16 / 8; }
	.issue { padding: 18px; }
	.cf-field textarea { min-height: 70px; }
	.contact-form { gap: 12px 16px; }
}
@media (min-width: 641px) and (max-height: 680px) {
	.news-card:not(.text-card) .news-body p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
	.foot-about p { display: none; }
}

/* =========================================================
   9. Tablet (≤ 1024px)
   ========================================================= */
@media (max-width: 1024px) {
	:root { --header-h: 64px; --gutter: 24px; }
	.brand { font-size: 19px; --badge: 76px; margin-top: 7px; }
	.brand-name { margin-top: calc((var(--header-h) - 7px - 19px) / 2 - 2px); }
	.site-nav .menu { gap: 16px; }
	.site-nav a { font-size: 15px; }
	.snap-section { --rail-space: 36px; }
	.rail { right: 10px; }
	.rail-label { display: none; }
}

/* Drop-panel menu for tablet portrait and phones */
@media (max-width: 959px) {
	.menu-toggle { display: block; }
	.site-nav {
		position: fixed; left: 0; right: 0; top: var(--hh);
		z-index: 58;
		background: var(--green-mid);
		border-bottom: 1px solid rgba(5, 39, 48, .55);
		box-shadow: 0 18px 30px -18px rgba(0,0,0,.5);
		max-height: calc(100dvh - var(--hh));
		overflow-y: auto;
		opacity: 0; visibility: hidden;
		transform: translateY(-10px);
		transition: opacity .28s var(--ease), transform .28s var(--ease), visibility 0s linear .28s;
	}
	.admin-bar .site-nav { top: var(--top); }
	.nav-open .site-nav {
		opacity: 1; visibility: visible; transform: none;
		transition: opacity .28s var(--ease), transform .28s var(--ease), visibility 0s;
	}
	.site-nav .menu { flex-direction: column; gap: 0; padding: 6px var(--gutter) 14px; max-width: 720px; margin: 0 auto; }
	.site-nav li + li { border-top: 1px solid rgba(255,255,255,.14); }
	.site-nav a { font-size: 21px; padding: 14px 0; text-transform: uppercase; }
	.site-nav a::after { bottom: 10px; right: auto; width: 36px; }
	.nav-open body, body.nav-open { overflow: hidden; }
}

@media (min-width: 641px) and (max-width: 959px) {
	.news-grid.campaign-grid { grid-template-columns: 1fr 1fr; grid-template-rows: 1.2fr 1fr 1fr; height: clamp(420px, calc(100dvh - var(--top) - 190px), 900px); gap: 14px; }
	.campaign-grid > .lead { grid-column: 1 / -1; }
	.campaign-grid.count-1 { grid-template-rows: 1fr 1fr; }
	.campaign-grid.count-1 .campaign-all { grid-column: 1 / -1; }
	.campaign-grid.count-2 { grid-template-rows: 1.2fr 1fr; }
	.campaign-grid.count-2 .campaign-all { grid-column: auto; }
	.campaign-grid.count-3 .campaign-all { grid-column: 1 / -1; }
	.issue-cards { grid-template-columns: repeat(2, 1fr); gap: 12px; }
	.news-card.text-card .news-body { padding: 14px 16px; }
	.involve-panel.has-3 { gap: 14px; }
	.involve-panel.has-3 .involve-card { padding: 20px 18px; }
	.involve-panel.has-3 .involve-card h3 { font-size: 21px; }
	.involve-panel.has-3 .involve-card p { font-size: 14px; }
	.elections-grid { grid-template-columns: 1.2fr 1fr; gap: 22px; }
	.news-grid, .related-grid { gap: 14px; }
	.news-body { padding: 14px; }
	.news-body h3 { font-size: 17px; }
	.issue { padding: 18px 16px; }
	.issue h3 { font-size: 19px; }
	.foot-grid { gap: 20px; }
}

/* Tablet portrait has plenty of height: give things room, stack the elections card */
@media (min-width: 641px) and (max-width: 959px) and (min-height: 900px) {
	.elections-grid { grid-template-columns: 1fr; }
	.elect-card { max-width: 560px; }
	.snap-section { padding-top: 72px; }
	.snap-section h1, .snap-section h2 { font-size: 50px; }
	.lede, .elections-text, .about-text p { font-size: 19px; }
	.involve-panel { margin-top: 44px; }
	.involve-card { padding: 30px 26px; }
	.involve-card h3 { font-size: 30px; }
	.involve-panel.has-3 .involve-card { padding: 24px 20px; }
	.involve-panel.has-3 .involve-card h3 { font-size: 24px; }
	.involve-card p, .elect-card p { font-size: 16px; }
	.news-grid { grid-template-columns: 1fr 1fr; }
	.news-grid.home-news { grid-template-columns: repeat(2, 1fr); max-width: min(100%, calc((100dvh - var(--top) - 320px) * 1.15)); }
	.news-body h3 { font-size: 19px; }
	.news-body p { font-size: 15px; }
	.issues-grid { grid-template-columns: 1fr; }
	.issue { padding: 24px 22px; }
	.issue h3 { font-size: 24px; }
	.issue p { font-size: 16px; }
	.cf-field textarea { min-height: 150px; }
}

/* =========================================================
   10. Phone (≤ 640px)
   ========================================================= */
@media (max-width: 640px) {
	:root { --header-h: 58px; --gutter: 18px; }
	.brand { font-size: 17px; gap: 10px; --badge: 64px; margin-top: 6px; }
	.brand-badge { border-width: 1px; }
	.brand-name { margin-top: calc((var(--header-h) - 6px - 17px) / 2 - 2px); }
	.site-nav .menu { padding-top: 22px; }
	.snap-section { --rail-space: 14px; padding-top: clamp(18px, 3.2vh, 32px); padding-bottom: 18px; }
	.snap-section > .section-inner { padding-left: var(--gutter); }
	.snap-section h1, .snap-section h2 { font-size: clamp(28px, 8.6vw, 38px); }
	.rail { right: 4px; gap: 2px; }
	.rail a { width: 18px; height: 20px; }
	.rail .dot { width: 7px; height: 7px; }

	.lede { font-size: 15px; margin-top: 10px; }
	.hero-photo { height: clamp(90px, 17vh, 170px); margin-bottom: 14px; border-width: 2px; }
	.involve-panel { grid-template-columns: 1fr; gap: 12px; margin-top: 18px; }
	.involve-card { padding: 16px 18px; }
	.involve-card h3 { font-size: 21px; margin-bottom: 4px; }
	.involve-card p { font-size: 14px; margin-bottom: 12px; }
	/* With three cards, each becomes a compact row: title left, button right */
	.involve-panel.has-3 { grid-template-columns: 1fr; gap: 10px; }
	.involve-panel.has-3 .involve-card { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 16px; }
	.involve-panel.has-3 .involve-card h3 { font-size: 19px; margin: 0; }
	.involve-panel.has-3 .involve-card p { display: none; }
	.involve-panel.has-3 .involve-card .btn { margin: 0; flex: none; padding: 9px 14px; font-size: 15px; }
	.btn { font-size: 16px; padding: 10px 16px; }

	.elections-grid { grid-template-columns: 1fr; gap: 18px; }
	.elections-text { font-size: 16px; }
	.cta-row { gap: 10px; }
	.elect-card { padding: 16px 18px; }
	.elect-card p { font-size: 14px; margin-bottom: 10px; }

	/* Branch news: horizontal swipe row */
	.news-grid.swipe-row, .issue-cards.swipe-row {
		display: flex; gap: 12px;
		overflow-x: auto; overscroll-behavior-x: contain;
		scroll-snap-type: x mandatory;
		margin: 0 calc(-1 * var(--rail-space) - var(--gutter)) 0 calc(-1 * var(--gutter));
		padding: 4px var(--gutter) 8px;
		scroll-padding-inline: var(--gutter);
		scrollbar-width: none;
	}
	.news-grid.swipe-row::-webkit-scrollbar, .issue-cards.swipe-row::-webkit-scrollbar { display: none; }
	.issue-cards.swipe-row .news-card { flex: 0 0 72%; }
	.news-grid.campaign-grid { height: auto; }
	.campaign-grid > .news-card { grid-row: auto !important; grid-column: auto !important; }
	.campaign-grid > .lead { flex-direction: column; }
	.campaign-grid .lead .news-thumb { flex: none; }
	.campaign-grid .news-thumb { flex: none; aspect-ratio: 16 / 9; }
	.campaign-grid .lead .news-body h3 { font-size: 20px; }
	.news-card.campaign-all { min-height: 220px; }
	.issue-cards { grid-template-columns: 1fr; }
	.hero-copy .lede { max-width: none; }
	.involve-panel.has-3 .involve-card .btn { align-self: auto; }
	.in-section .foot-logo .logo-mark.foot-mark { width: 56px; }
	.swipe-row .news-card { flex: 0 0 82%; scroll-snap-align: start; }
	.swipe-row .news-card:hover { transform: none; }
	.swipe-row .news-thumb { aspect-ratio: 16 / 9; }
	.swipe-dots { display: flex; gap: 6px; justify-content: center; margin-top: 12px; }
	.swipe-dots span { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.35); transition: background-color var(--fade), transform var(--fade); }
	.swipe-dots span.on { background: var(--green); transform: scale(1.3); }

	.issues-grid { grid-template-columns: 1fr; gap: 1px; }
	.issue { padding: 14px 16px; }
	.issue h3 { font-size: 18px; margin-bottom: 4px; }
	.issue p { font-size: 14px; line-height: 1.4; }

	.about-text p { font-size: 16px; }

	.contact-form { gap: 10px 12px; margin-bottom: 18px; }
	.cf-field label { font-size: 12px; }
	.cf-field input, .cf-field textarea { font-size: 16px; padding: 8px 10px; } /* 16px stops iOS zooming */
	.cf-field textarea { min-height: 64px; }
	.in-section .foot-grid { grid-template-columns: 1fr 1fr; gap: 12px 16px; padding-top: 16px; margin-bottom: 12px; }
	.in-section .foot-about { grid-column: 1 / -1; }
	.in-section .foot-about p { display: none; }
	.in-section .menu li { margin-bottom: 3px; }
	.site-footer h4 { font-size: 13px; margin-bottom: 6px; }
	.site-footer p, .site-footer a { font-size: 13px; }
	.foot-bottom { font-size: 11px; padding-top: 10px; flex-direction: column; }

	/* Inner pages */
	.titleband { padding: 30px 0; }
	.postband { padding: 30px 0 56px; }
	.featured { margin: -32px var(--gutter) 0; aspect-ratio: 16 / 9; }
	.entry-content { padding-top: 32px; padding-bottom: 44px; }
	.entry-content p, .entry-content li { font-size: 16px; }
	.entry-content .alignleft, .entry-content .alignright { float: none; margin: 18px 0; max-width: 100%; }
	.related-grid, .news-grid, .foot-grid { grid-template-columns: 1fr; }
	.related { padding: 36px 0; }
	.site-footer { padding: 34px 0 24px; }
}

/* Short phones (e.g. iPhone SE): trim secondary copy */
@media (max-width: 640px) and (max-height: 700px) {
	.involve-card p { display: none; }
	.involve-card h3 { margin-bottom: 10px; }
	.elect-card p:nth-of-type(2), .elect-card h3:nth-of-type(2) { display: none; }
	.swipe-row .news-card:not(.text-card) .news-body p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
	.in-section .foot-col:last-child { display: none; }
	.in-section .foot-grid { grid-template-columns: 1fr; }
}

/* Phones held sideways / very short windows: a full-screen section can't
   hold the content, so fall back to a normal scrolling page. */
@media (max-height: 500px) {
	html.sbg-snap { scroll-snap-type: none; }
	.snap-section { height: auto; min-height: calc(100dvh - var(--top)); overflow: visible; }
	.snap-section > .section-inner { transform: none !important; }
	.rail { display: none; }
}

/* =========================================================
   11. Motion preferences
   ========================================================= */
@media (prefers-reduced-motion: no-preference) {
	html.sbg-snap { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
	.js .snap-section .section-inner > * { opacity: 1; transform: none; }
}

/* =========================================================
   12. Newsletter pop-up
   ========================================================= */
.nl-overlay {
	position: fixed; inset: 0; z-index: 100;
	display: flex; align-items: center; justify-content: center;
	padding: 20px;
	background: rgba(5, 39, 48, .62);
	opacity: 0;
	transition: opacity .3s var(--ease);
}
.nl-overlay[hidden] { display: none; }
.nl-overlay.is-open { opacity: 1; }
html.nl-locked, html.nl-locked body { overflow: hidden; }

.nl-modal {
	position: relative;
	width: 100%; max-width: 760px;
	max-height: calc(100dvh - 40px);
	display: grid; grid-template-columns: 5fr 6fr;
	background: var(--off-white); color: var(--dark);
	border: 3px solid var(--dark); border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 24px 60px rgba(0, 0, 0, .4);
	transform: translateY(16px) scale(.98);
	transition: transform .35s var(--ease);
}
.nl-modal:focus { outline: none; }
.nl-overlay.is-open .nl-modal { transform: none; }
.nl-photo { background-size: cover; background-position: center; min-height: 100%; }
.nl-body { position: relative; padding: 34px 30px 28px; overflow-y: auto; }
.nl-body h2 { font-size: 30px; color: var(--green-mid); margin-bottom: 10px; padding-right: 36px; }
.nl-body h2:focus { outline: none; }
.nl-lead { font-size: 15px; margin-bottom: 18px; }
.nl-body label {
	display: block; margin-bottom: 5px;
	font-family: var(--font-head); font-weight: 800; font-size: 13px;
	text-transform: uppercase; letter-spacing: .3px;
}
.nl-body input[type="text"], .nl-body input[type="email"] {
	width: 100%; margin-bottom: 14px;
	font-size: 16px; padding: 11px 12px;
	background: #fff; color: var(--dark);
	border: 2px solid var(--dark); border-radius: 8px;
	transition: border-color var(--fade), box-shadow var(--fade);
}
.nl-body input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(0, 154, 87, .3); }
.nl-body input[aria-invalid="true"] { border-color: var(--pink); }
.nl-submit {
	width: 100%; padding: 12px;
	font-family: var(--font-head); font-weight: 800; font-size: 18px; text-transform: uppercase;
	background: var(--green-mid); color: #fff;
	border: 2px solid var(--dark); border-radius: 8px;
	cursor: pointer;
	transition: background-color var(--fade), transform var(--fade);
}
.nl-submit:hover, .nl-submit:focus-visible { background: var(--green); }
.nl-submit[disabled] { opacity: .6; cursor: progress; }
.nl-fine { font-size: 12px; color: #4c6963; margin-top: 12px; }
.nl-fine a { text-decoration: underline; }
.nl-err { color: var(--pink); font-size: 13px; font-weight: 700; min-height: 18px; margin: -6px 0 8px; }
.nl-close {
	position: absolute; top: 12px; right: 12px; z-index: 2;
	display: grid; place-items: center;
	width: 36px; height: 36px; border-radius: 50%;
	border: 2px solid var(--dark); background: #fff; color: var(--dark);
	cursor: pointer;
	transition: background-color var(--fade), transform var(--fade);
}
.nl-close svg { width: 16px; height: 16px; }
.nl-close:hover, .nl-close:focus-visible { background: var(--pale-yellow); transform: rotate(90deg); }
.nl-done { animation: nl-in .4s var(--ease); }
@keyframes nl-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Tablet portrait: stack, photo as a banner */
@media (max-width: 820px) {
	.nl-modal { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); max-width: 520px; }
	.nl-photo { min-height: 0; aspect-ratio: 16 / 7; }
	.nl-body { padding: 26px 24px 22px; }
	.nl-body h2 { font-size: 27px; }
}
/* Phone: slides up from the bottom as a sheet */
@media (max-width: 640px) {
	.nl-overlay { align-items: flex-end; padding: 0; }
	.nl-modal {
		max-width: none; max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px));
		border-width: 3px 0 0; border-radius: 16px 16px 0 0;
		transform: translateY(100%);
	}
	.nl-photo { aspect-ratio: 16 / 6; }
	.nl-body { padding: 22px var(--gutter) calc(18px + env(safe-area-inset-bottom, 0px)); }
	.nl-body h2 { font-size: 25px; margin-bottom: 6px; }
	.nl-lead { font-size: 14px; margin-bottom: 14px; }
	.nl-body input[type="text"], .nl-body input[type="email"] { padding: 9px 11px; margin-bottom: 10px; }
	.nl-close { top: 12px; right: 12px; width: 40px; height: 40px; }
}
@media (max-width: 640px) and (max-height: 700px) {
	.nl-photo { display: none; }
}
@media (prefers-reduced-motion: reduce) {
	.nl-modal { transform: none !important; }
}

/* =========================================================
   13. Page pop-ups (Donate / Support Us) and parent-page card groups
   ========================================================= */
.page-modal { grid-template-columns: 1fr; max-width: 720px; }
.page-modal .nl-body { padding: 34px 34px 28px; }
.page-modal h2 { font-size: 32px; }
.dialog-content { padding: 0; font-size: 16px; }
.dialog-content > * + * { margin-top: 14px; }
.dialog-content p, .dialog-content li { font-size: 16px; }
.dialog-content h2 { font-size: 22px; text-transform: none; color: var(--green-mid); margin-top: 24px; }
.dialog-content h3 { font-size: 18px; margin-top: 20px; }
.dialog-more { display: inline-block; margin-top: 22px; color: var(--green-mid); }
@media (max-width: 640px) {
	.page-modal .nl-body { padding: 24px var(--gutter) calc(20px + env(safe-area-inset-bottom, 0px)); }
	.page-modal h2 { font-size: 26px; }
}

.child-pages { padding: 0 0 64px; }
.child-heading { font-size: clamp(26px, 3.4vw, 34px); margin-bottom: 22px; }
.child-group + .child-group { margin-top: 52px; padding-top: 40px; border-top: 3px solid var(--light); }
.child-group-previous .child-heading { color: var(--green-mid); }
.child-pages .news-card { border: 1px solid #cfe5dc; }
.child-pages .news-card.text-card { border: 2px solid var(--dark); }
@media (max-width: 640px) {
	.child-pages .news-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   14. Social icons (header + Contact section)
   ========================================================= */
.site-nav { display: flex; align-items: center; gap: 22px; }
.social-icons { display: flex; align-items: center; gap: 12px; list-style: none; }
.social-icons a { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; transition: color var(--fade), background-color var(--fade), transform var(--fade); }
.social-icons svg { width: 18px; height: 18px; }
.social-header { padding-left: 18px; border-left: 1px solid rgba(255,255,255,.25); gap: 4px; }
.social-header a { color: #dff3ea; }
.social-header a:hover, .social-header a:focus-visible { color: #fff; background: rgba(255,255,255,.12); transform: translateY(-1px); }
.cf-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: clamp(14px, 3vh, 24px); }
.cf-head .cf-heading { margin-bottom: 0; }
.social-contact a { width: 44px; height: 44px; background: rgba(255,255,255,.08); color: var(--green); }
.social-contact svg { width: 22px; height: 22px; }
.social-contact a:hover, .social-contact a:focus-visible { background: var(--green); color: #fff; transform: translateY(-2px); }
@media (max-width: 1100px) and (min-width: 960px) {
	.site-nav { gap: 14px; }
	.social-header { padding-left: 10px; }
	.social-header a { width: 28px; height: 28px; }
}
@media (max-width: 959px) {
	.site-nav { display: block; }
	.social-header { border-left: 0; padding: 4px var(--gutter) 18px; max-width: 720px; margin: 0 auto; gap: 10px; }
	.social-header a { width: 40px; height: 40px; background: rgba(255,255,255,.1); }
	.social-header svg { width: 20px; height: 20px; }
}
@media (max-width: 640px) {
	.social-contact a { width: 36px; height: 36px; }
	.social-contact svg { width: 18px; height: 18px; }
}

/* =========================================================
   15. Events
   ========================================================= */
#events { background: var(--events-bg); color: #fff; }
#events .section-head .text-link { color: var(--pale-yellow); }
#events .swipe-dots span { background: rgba(255,255,255,.4); }
#events .swipe-dots span.on { background: var(--pale-yellow); }
.event-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.event-card {
	display: flex; gap: 18px; align-items: flex-start;
	background: #fff; color: var(--dark);
	border-radius: 10px; padding: 18px;
	transition: transform var(--fade), box-shadow var(--fade);
}
.event-card:hover { transform: translateY(-2px); box-shadow: 0 12px 26px -16px rgba(0,0,0,.55); }
.ev-date {
	display: inline-block; flex: none; width: 76px; text-align: center;
	background: var(--dark); color: #fff; border-radius: 8px;
	padding: 8px 4px 9px; line-height: 1;
	font-family: var(--font-head); text-transform: uppercase;
}
.ev-dow { display: block; font-size: 13px; font-weight: 700; color: var(--green); letter-spacing: .5px; }
.ev-day { display: block; font-size: 36px; font-weight: 800; margin: 4px 0 2px; }
.ev-mon { display: block; font-size: 15px; font-weight: 800; color: var(--pale-yellow); }
.ev-body { min-width: 0; }
.ev-body h3 { font-size: 21px; line-height: 1.08; margin-bottom: 6px; }
.ev-body h3 a { transition: color var(--fade); }
.ev-body h3 a::after { content: ""; position: absolute; inset: 0; }
.event-card { position: relative; }
.ev-body h3 a:hover { color: var(--green-mid); }
.ev-when { font-size: 14px; font-weight: 700; color: var(--green-mid); }
.ev-venue { font-size: 14px; color: #3c4f4a; margin-top: 2px; }
.ev-excerpt { font-size: 15px; margin-top: 10px; }
.ev-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; position: relative; z-index: 1; }
.btn-outline-dark { background: transparent; color: var(--dark); border-color: var(--dark); }
.btn-outline-dark:hover, .btn-outline-dark:focus-visible { background: var(--dark); color: #fff; }
.events-empty { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; font-size: 18px; max-width: 70ch; }

/* Events page + single event */
.eventsband { background: var(--events-bg); }
.eventsband .post-title { font-size: clamp(24px, 3vw, 34px); text-transform: none; line-height: 1.08; }
.events-list { display: grid; gap: 18px; padding-top: 40px; padding-bottom: 64px; }
/* Events page cards: date | details | buttons on the right */
.event-card.is-full { align-items: center; }
.event-card.is-full .ev-body { flex: 1 1 auto; }
.event-card.is-full .ev-actions { flex: none; margin: 0 0 0 auto; justify-content: flex-end; }
.events-list .event-card { border: 2px solid var(--dark); }
.events-list .ev-date { width: 88px; }
.events-list .ev-day { font-size: 42px; }
.events-list .ev-body h3 { font-size: 24px; }
.event-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 40px; padding-top: 40px; padding-bottom: 64px; align-items: start; }
.event-facts { background: var(--light); border-radius: 10px; padding: 22px; position: sticky; top: calc(var(--top) + 40px); }
.event-facts .ev-date { margin-bottom: 16px; }
.event-facts dt { font-family: var(--font-head); font-weight: 800; text-transform: uppercase; font-size: 13px; color: var(--green-mid); margin-top: 12px; }
.event-facts dd { font-size: 16px; }
.event-facts .ev-actions { flex-direction: column; align-items: stretch; }
.event-facts .ev-actions .btn { text-align: center; }
.ev-past { font-weight: 700; color: var(--pink); }
.event-content { padding: 0; }
.event-image { border-radius: 10px; margin-bottom: 22px; width: 100%; height: auto; }

@media (min-width: 641px) and (max-height: 760px) {
	.event-card { padding: 14px; }
	.ev-day { font-size: 30px; }
}
@media (max-width: 820px) {
	.event-layout { grid-template-columns: 1fr; gap: 24px; }
	.event-facts { position: static; }
}
@media (max-width: 640px) {
	.event-grid.swipe-row {
		display: flex; gap: 12px; overflow-x: auto; overscroll-behavior-x: contain;
		scroll-snap-type: x mandatory; scrollbar-width: none;
		margin: 0 calc(-1 * var(--rail-space) - var(--gutter)) 0 calc(-1 * var(--gutter));
		padding: 4px var(--gutter) 8px; scroll-padding-inline: var(--gutter);
	}
	.event-grid.swipe-row::-webkit-scrollbar { display: none; }
	.event-grid.swipe-row .event-card { flex: 0 0 84%; scroll-snap-align: start; }
	.event-card { gap: 14px; padding: 14px; }
	.ev-date { width: 64px; }
	.ev-day { font-size: 30px; }
	.ev-body h3 { font-size: 18px; }
	.events-list { padding-top: 28px; }
	.events-list .event-card { flex-direction: column; align-items: flex-start; }
	.event-card.is-full .ev-actions { margin: 4px 0 0; justify-content: flex-start; }
}

/* Short screens: the footer inside the Contact section uses two link columns */
@media (min-width: 641px) and (max-height: 800px) {
	.in-section .foot-col .menu { columns: 2; column-gap: 24px; }
	.in-section .foot-col .menu li { break-inside: avoid; }
}

@media (max-width: 640px) and (max-height: 700px) {
	.in-section .foot-col .menu { columns: 2; column-gap: 16px; }
	/* Smallest phones: "Follow us" becomes a single row beside its label */
	.contact-split { gap: 12px; }
	.follow-us { display: flex; align-items: center; gap: 12px; }
	.follow-us h3 { margin: 0; font-size: 16px; }
	.follow-list .fl-icon { width: 34px; height: 34px; }
	.cf-field textarea { min-height: 52px; }
	.in-section .foot-about { display: none; }
}

/* =========================================================
   16. Inner pages line up with the homepage
   ========================================================= */
/* Homepage sections sit inside a wider inset (room for the dots on the
   right); inner pages use the same inset so headings, text and images
   start exactly where the homepage's do. */
:root { --inset: 44px; }
@media (max-width: 1024px) { :root { --inset: 36px; } }
@media (max-width: 640px)  { :root { --inset: 0px; } }
html.sbg-flow .wrap { padding-left: calc(var(--gutter) + var(--inset)); padding-right: calc(var(--gutter) + var(--inset)); }
html.sbg-flow .entry-content.content-narrow { max-width: calc(1080px + 2 * var(--gutter)); }
html.sbg-flow .entry-content.content-narrow > * { max-width: 760px; }
.featured-wrap { position: relative; z-index: 1; }
.featured-wrap .featured { max-width: none; margin: -40px 0 0; }

/* Title bands fade into the page below rather than stopping sharply */
.titleband, .postband { --fade-to: var(--off-white); background-image: linear-gradient(to bottom, transparent calc(100% - 64px), var(--fade-to)); padding-bottom: 76px; }
.postband { padding-bottom: 96px; }
.news-archive .newsband { background-image: none; }
.titleband.band-campaigns { background-color: var(--green); }
.titleband.band-issues { background-color: var(--light); color: var(--dark); }
.titleband.band-issues .band-label a, .titleband.band-issues h1 { color: var(--dark); }
.titleband.band-issues .post-title { color: var(--green-mid); }
.eventsband { background-color: var(--events-bg); }
.titleband { background-color: var(--green); }
.postband { background-color: var(--news-bg); }
.child-pages { margin-top: -8px; }
@media (max-width: 640px) {
	.titleband, .postband { padding-bottom: 52px; }
	.postband { padding-bottom: 72px; }
}

/* =========================================================
   17. Contact: form on the left, "Follow us" on the right
   ========================================================= */
.contact-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: start; margin-bottom: clamp(22px, 5vh, 44px); }
.contact-split .contact-form { max-width: none; margin-bottom: 0; }
.follow-us h3 { font-size: 22px; text-transform: uppercase; color: #fff; margin-bottom: 8px; }
.follow-us > p { font-size: 15px; color: #cfe9e0; margin-bottom: 16px; max-width: 42ch; }
.follow-list { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.follow-list a {
	display: flex; align-items: center; gap: 12px;
	padding: 10px 14px; border-radius: 10px;
	background: rgba(255,255,255,.07); color: #fff;
	font-family: var(--font-head); font-weight: 700; font-size: 17px;
	transition: background-color var(--fade), color var(--fade), transform var(--fade);
}
.follow-list .fl-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--green); color: #fff; flex: none; transition: background-color var(--fade), color var(--fade); }
.follow-list svg { width: 18px; height: 18px; }
.follow-list a:hover, .follow-list a:focus-visible { background: rgba(255,255,255,.14); transform: translateY(-1px); }
.follow-list a:hover .fl-icon { background: #fff; color: var(--green-mid); }
.follow-list li:first-child { grid-column: 1 / -1; }
.follow-list li:first-child a { background: var(--pink); }
.follow-list li:first-child .fl-icon { background: rgba(255,255,255,.2); }
.follow-list li:first-child a:hover { background: var(--pink-dark); }
@media (max-height: 760px) and (min-width: 641px) {
	.follow-us > p { display: none; }
	.follow-list a { padding: 7px 12px; font-size: 16px; }
	.follow-list .fl-icon { width: 30px; height: 30px; }
}
@media (max-width: 820px) {
	.contact-split { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 640px) {
	.follow-us > p { display: none; }
	.follow-us h3 { font-size: 18px; margin-bottom: 8px; }
	.follow-list { grid-template-columns: repeat(4, auto); justify-content: start; gap: 8px; }
	.follow-list li:first-child { grid-column: auto; }
	.follow-list a { padding: 0; background: none; font-size: 0; gap: 0; }
	.follow-list li:first-child a { background: none; }
	.follow-list .fl-icon { width: 40px; height: 40px; }
	.follow-list li:first-child .fl-icon { background: var(--pink); }
}

/* WordPress core classes */
.wp-caption, .gallery-caption { font-size: 14px; }
.sticky, .bypostauthor { }
.aligncenter { margin-left: auto; margin-right: auto; }

/* Fit guard fallback: section scrolls within itself rather than overflow */
.snap-section.is-scrollable { overflow-y: auto; overscroll-behavior: contain; }
