/*
Theme Name: Save Our Montana
Author: Crosby Creative Co.
Description: Single-page theme for Save Our Montana. Edit the copy under Appearance → Customize → Page Copy.
Version: 1.5.0
Requires at least: 6.4
Requires PHP: 7.4
Text Domain: saveourmontana
*/

:root {
	--pine: #2E4636;
	--pine-deep: #1B2A21;
	--copper: #B5613A;
	--copper-dark: #9A4F2D;
	--copper-text: #9F5533; /* copper dark enough for small text and the button (4.7:1 on bone) */
	--copper-text-hover: #86472A;
	--wheat: #D9A64A;
	--sky: #4F7A99;
	--bone: #F3EDE2;
	--coal: #1E221F;
	--muted: #5E605A;
	--gutter: clamp(16px, 4vw, 56px);
	--serif: "Young Serif", Georgia, serif;
	--script: "Yellowtail", cursive;
	--sans: "Bricolage Grotesque", system-ui, sans-serif;
	--ease-out: cubic-bezier(.16, 1, .3, 1);
}

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

html { scroll-behavior: smooth; }

body {
	margin: 0;
	background: var(--bone);
	color: var(--coal);
	font-family: var(--sans);
	font-size: 18px;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; }

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

/* Condensed caps label style, used in a few places */
.topbar-link,
.button,
.panel-label {
	font-family: var(--sans);
	font-variation-settings: "wdth" 75;
	font-weight: 700;
	letter-spacing: .14em;
	text-transform: uppercase;
}

/* ---------- WordPress admin bar (logged-in users only) ---------- */

/* Let the bar scroll away with the page instead of covering the top of the hero */
#wpadminbar { position: absolute; }

/* Keep the full hero on screen below the bar, and start our top bar below it too */
.admin-bar .hero {
	height: calc(100vh - 32px);
	height: calc(100svh - 32px);
}
.admin-bar .topbar:not(.topbar--solid) { top: 32px; }
@media screen and (max-width: 782px) {
	.admin-bar .hero {
		height: calc(100vh - 46px);
		height: calc(100svh - 46px);
	}
	.admin-bar .topbar:not(.topbar--solid) { top: 46px; }
}

/* ---------- Focus and screen-reader helpers ---------- */

:focus-visible {
	outline: 3px solid var(--pine);
	outline-offset: 3px;
}
.hero :focus-visible,
.foot :focus-visible,
.panel:focus-visible {
	outline-color: var(--wheat);
}

.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 ---------- */

.skip-link {
	position: absolute;
	z-index: 100;
	top: 8px;
	left: 8px;
	padding: 10px 16px;
	background: var(--bone);
	color: var(--pine);
	font-weight: 700;
	text-decoration: none;
	transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ---------- Top bar ---------- */

.topbar {
	position: absolute;
	z-index: 10;
	top: 0;
	left: 0;
	right: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: clamp(14px, 2.4vw, 28px) var(--gutter);
	color: var(--bone);
}

.topbar-mark { display: block; width: clamp(40px, 4vw, 52px); color: var(--bone); }
.topbar-mark svg { display: block; width: 100%; height: auto; }

.topbar-link {
	font-size: 13px;
	text-decoration: none;
	padding: 9px 14px;
	/* Frosted backing so the link stays readable over any sky */
	background: rgba(27, 42, 33, .68);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	border: 1px solid rgba(243, 237, 226, .22);
	border-radius: 2px;
	transition: background .2s, border-color .2s;
}
.topbar-link:hover { background: rgba(27, 42, 33, .85); border-color: var(--wheat); }

/* ---------- Hero ---------- */

.hero {
	position: relative;
	height: 100vh;
	height: 100svh;
	min-height: 560px;
	overflow: hidden;
	background: var(--pine-deep);
	container-type: size;
}

/*
 * The stage keeps the photo at its true aspect ratio and covers the viewport,
 * so the headline, the photo and the mountain cutout always line up exactly.
 */
.hero-stage {
	--ratio: 1.5;
	--w: max(100cqw, calc(100cqh * var(--ratio)));
	--h: calc(var(--w) / var(--ratio));
	position: absolute;
	width: var(--w);
	height: var(--h);
	left: calc((100cqw - var(--w)) * .15);
	top: calc((100cqh - var(--h)) * .2);
	container-type: inline-size;
	transform-origin: 62% 30%;
	animation: settle 3.2s var(--ease-out) both;
}

.hero-layer,
.hero-title {
	position: absolute;
	inset: 0;
	margin: 0;
	will-change: transform;
}

.hero-layer picture,
.hero-layer img {
	width: 100%;
	height: 100%;
}
.hero-layer img { object-fit: cover; }



.hero-title {
	font-weight: 400;
	color: var(--bone);
	line-height: 1;
	pointer-events: none;
}

.hero-word {
	position: absolute;
	/* Line up with the page margin: undo the stage's horizontal offset, then add the gutter */
	left: calc(var(--gutter) + (100cqw - 100vw) * .15);
	top: 20.4%;
	font-family: var(--serif);
	font-size: 9.8cqi;
	letter-spacing: .03em;
	text-transform: uppercase;
	text-shadow: 0 .02em .12em rgba(20, 28, 23, .25);
	animation: rise 2.4s .5s var(--ease-out) both;
}

.hero-script {
	position: absolute;
	left: calc(var(--gutter) + (100cqw - 100vw) * .15);
	top: 13.6%;
	font-family: var(--script);
	font-size: 4.2cqi;
	color: var(--wheat);
	transform: rotate(-4deg);
	text-shadow: 0 .04em .2em rgba(20, 28, 23, .35);
	animation: fade 1.6s 1.5s ease-out both;
}

/* Phones and portrait tablets get the tall Mount Wilbur shot */
@media (max-aspect-ratio: 6/5) {
	.hero-stage {
		--ratio: .6667;
		left: calc((100cqw - var(--w)) * .5);
		top: 0;
		transform-origin: 55% 15%;
	}
	/* Sized to the screen, not the photo, so the word always fits */
	.hero-word {
		left: 50%;
		top: 7.6%;
		font-size: min(14vw, 9.5cqi);
		translate: -50% 0;
	}
	.hero-script {
		left: 50%;
		top: 4.2%;
		font-size: min(7.6vw, 5.2cqi);
		translate: -50% 0;
	}
}

@media (max-width: 599px) {
	.topbar-link { display: none; }
}

.hero-shade {
	position: absolute;
	inset: 0;
	background:
		linear-gradient(to bottom, rgba(18, 26, 21, .35), transparent 18%),
		linear-gradient(to top, rgba(18, 26, 21, .88) 0%, rgba(18, 26, 21, .55) 28%, transparent 58%);
	pointer-events: none;
}

/* Fine film grain over the photo */
.hero-shade::after {
	content: "";
	position: absolute;
	inset: 0;
	opacity: .14;
	mix-blend-mode: overlay;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.hero-copy {
	position: absolute;
	z-index: 2;
	left: var(--gutter);
	right: var(--gutter);
	bottom: clamp(28px, 7vh, 80px);
	max-width: 36rem;
	color: var(--bone);
	animation: fade 1.4s 1.9s ease-out both;
}

.hero-statement {
	margin: 0 0 12px;
	font-family: var(--serif);
	font-size: clamp(26px, 3.1vw, 42px);
	line-height: 1.12;
	text-wrap: balance;
}

.hero-intro {
	margin: 0 0 24px;
	max-width: 30rem;
	color: rgba(243, 237, 226, .86);
	font-size: clamp(16px, 1.3vw, 19px);
}

.button {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 14px 22px;
	background: var(--copper-text);
	color: var(--bone);
	font-size: 14px;
	text-decoration: none;
	border-radius: 2px;
	transition: background .2s;
}
.button svg { width: 14px; height: 14px; transition: transform .25s var(--ease-out); }
.button:hover { background: var(--copper-text-hover); }
.button:hover svg { transform: translateY(3px); }

@keyframes settle {
	from { scale: 1.12; }
	to { scale: 1; }
}
@keyframes rise {
	from { transform: translateY(38%); opacity: 0; }
	30% { opacity: 1; }
	to { transform: translateY(0); opacity: 1; }
}
@keyframes fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

/* ---------- Issues ---------- */

.issues {
	padding: clamp(72px, 10vw, 140px) 0 clamp(88px, 12vw, 180px);
}

.issues-head { max-width: 46rem; }

.kicker {
	margin: 0 0 6px;
	font-family: var(--script);
	font-size: clamp(30px, 3vw, 40px);
	line-height: 1.1;
	color: var(--copper);
	transform: rotate(-3deg);
	transform-origin: left center;
}

.issues-head h2 {
	margin: 0;
	font-family: var(--serif);
	font-weight: 400;
	font-size: clamp(28px, 3.4vw, 46px);
	line-height: 1.14;
	color: var(--pine);
	text-wrap: balance;
}

.panels {
	display: grid;
	gap: 20px;
	margin-top: clamp(40px, 6vw, 72px);
}

.panel {
	position: relative;
	aspect-ratio: 4 / 5;
	overflow: hidden;
	border-radius: 3px;
	background: var(--pine);
	color: var(--bone);
}

.panel picture,
.panel img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}
.panel img {
	object-fit: cover;
	transition: transform 1.2s var(--ease-out);
}

.panel::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(18, 26, 21, .94) 0%, rgba(18, 26, 21, .74) 36%, transparent 68%);
}

.panel-text {
	position: absolute;
	z-index: 1;
	left: 0;
	right: 0;
	bottom: 0;
	padding: clamp(20px, 2.4vw, 32px);
}

.panel-label {
	display: flex;
	gap: 10px;
	align-items: center;
	margin: 0 0 10px;
	font-size: 12px;
	color: var(--wheat);
}
.panel-label span {
	padding-right: 10px;
	border-right: 1px solid rgba(217, 166, 74, .5);
}

.panel h3 {
	margin: 0;
	font-family: var(--serif);
	font-weight: 400;
	font-size: clamp(25px, 2.2vw, 31px);
	line-height: 1.1;
}

.panel-text > p:last-child {
	margin: 12px 0 0;
	font-size: 16px;
	line-height: 1.5;
	color: rgba(243, 237, 226, .88);
}

@media (min-width: 900px) {
	.panels {
		grid-template-columns: repeat(2, 1fr);
		gap: clamp(16px, 1.8vw, 28px);
		align-items: start;
	}
	.panel:nth-child(2) { margin-top: clamp(40px, 5vw, 80px); }
}

/* On devices with a mouse, the body text slides up on hover */
@media (hover: hover) and (min-width: 900px) {
	.panel-text > p:last-child {
		max-height: 0;
		margin-top: 0;
		opacity: 0;
		overflow: hidden;
		transition: max-height .6s var(--ease-out), margin .6s var(--ease-out), opacity .4s;
	}
	.panel:hover .panel-text > p:last-child,
	.panel:focus-within .panel-text > p:last-child {
		max-height: 10em;
		margin-top: 12px;
		opacity: 1;
	}
	.panel:hover img { transform: scale(1.05); }
}

/* ---------- Footer ---------- */

.foot {
	background: var(--pine);
	color: var(--bone);
	padding: clamp(56px, 7vw, 88px) 0 28px;
}

.foot-grid {
	display: grid;
	gap: 36px;
	align-items: start;
}

.foot-brand { display: block; width: clamp(180px, 18vw, 230px); }
.foot-logo { display: block; width: 100%; height: auto; }
.copyright {
	margin: 18px 0 0;
	font-size: 13px;
	color: rgba(243, 237, 226, .72);
}

.foot-grid .foot-label {
	margin: 0 0 8px !important;
	font-variation-settings: "wdth" 75;
	font-weight: 700;
	font-size: 12px;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--wheat);
}

.foot-contact p {
	margin: 0;
	font-size: 15px;
	line-height: 1.55;
	color: rgba(243, 237, 226, .85);
}

.disclaimer {
	margin: 0;
	flex: 0 1 auto;
	max-width: 100%;
	padding: 10px 16px;
	border: 1.5px solid rgba(243, 237, 226, .8);
	font-size: 13px;
	line-height: 1.5;
	color: var(--bone);
}
.disclaimer strong { font-weight: 700; }

/* One line on wide screens; on narrower ones the box shrinks with the text and wraps */
@media (min-width: 900px) {
	.disclaimer { white-space: nowrap; }
}

@media (min-width: 640px) {
	.foot-grid { grid-template-columns: 1fr 1fr; }
	.foot-brand-col { grid-column: 1 / -1; }
}

@media (min-width: 1000px) {
	.foot-grid {
		grid-template-columns: 1.6fr 1fr 1fr;
		gap: 48px;
	}
	.foot-brand-col { grid-column: auto; }
}

.foot-base {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	gap: 10px 28px;
	align-items: center;
	justify-content: space-between;
	margin-top: clamp(44px, 6vw, 64px);
	padding-top: 22px;
	font-size: 13px;
	color: rgba(243, 237, 226, .72);
}
.foot-base::before {
	content: "";
	position: absolute;
	top: 0;
	left: var(--gutter);
	right: var(--gutter);
	height: 1px;
	background: rgba(243, 237, 226, .18);
}
.foot-base p { margin: 0; }
.foot-legal { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.foot-legal a {
	font-size: 15px;
	color: rgba(243, 237, 226, .85);
	text-decoration: none;
	border-bottom: 1px solid rgba(243, 237, 226, .3);
	transition: color .2s, border-color .2s;
}
.foot-legal a:hover { color: var(--wheat); border-color: var(--wheat); }
.foot-base a {
	color: rgba(243, 237, 226, .85);
	text-decoration: none;
	border-bottom: 1px solid rgba(243, 237, 226, .3);
	transition: color .2s, border-color .2s;
}
.foot-base a:hover { color: var(--wheat); border-color: var(--wheat); }

@media (max-width: 759px) {
	.foot-base { flex-direction: column; align-items: flex-start; }
	.disclaimer { margin-bottom: 8px; }
}

/* ---------- Inner pages (Privacy, Terms) ---------- */

.topbar--solid {
	position: static;
	color: var(--pine);
	border-bottom: 1px solid rgba(46, 70, 54, .14);
}
.topbar--solid .topbar-mark { width: clamp(140px, 13vw, 172px); color: var(--pine); }
.topbar--solid .topbar-link {
	padding: 0 0 3px;
	background: none;
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
	border: 0;
	border-bottom: 1.5px solid rgba(46, 70, 54, .35);
	border-radius: 0;
}
.topbar--solid .topbar-link:hover { border-color: var(--copper-text); }
@media (max-width: 599px) {
	.topbar--solid .topbar-link { display: inline; }
}

.page-main { padding: clamp(48px, 8vw, 104px) 0 clamp(72px, 10vw, 128px); }

.page-body { max-width: 44rem; }

.page-body h1 {
	margin: 0 0 clamp(28px, 4vw, 44px);
	font-family: var(--serif);
	font-weight: 400;
	font-size: clamp(36px, 5vw, 60px);
	line-height: 1.05;
	color: var(--pine);
}

.prose { font-size: 17px; line-height: 1.7; }
.prose h2 {
	margin: 2.2em 0 .5em;
	font-family: var(--serif);
	font-weight: 400;
	font-size: 24px;
	line-height: 1.2;
	color: var(--pine);
}
.prose p { margin: 0 0 1.1em; }
.prose em { color: var(--muted); }
.prose a { color: var(--copper-text); text-underline-offset: 3px; }
.prose a:hover { color: var(--copper-text-hover); }

/* ---------- Scroll reveal (only when JS is running) ---------- */

.js .reveal {
	opacity: 0;
	transform: translateY(28px);
	transition: opacity 1s var(--ease-out), transform 1s var(--ease-out);
	transition-delay: calc(var(--i, 0) * 120ms);
}
.js .reveal.is-in {
	opacity: 1;
	transform: none;
}

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after {
		animation: none !important;
		transition: none !important;
	}
	.js .reveal { opacity: 1; transform: none; }
}
