/* Canadian Constitution Foundation: tokens, type, layout, buttons, forms.
   Loaded on the site and inside the editor iframe (add_editor_style).
   The design is drawn at 1920px wide. --u is one design pixel: 1px at 1920px and wider,
   scaling down with the window to 0.72px, then phone rules take over. */

:root {
	--u: clamp(0.72px, calc(100vw / 1920), 1px);

	--c-cream: #F0EDE8;
	--c-sand: #E8D9C9;
	--c-tan: #C9A378;
	--c-forest: #1C3830;
	--c-forest-deep: #152A25;
	--c-maroon: #6B001C;
	--c-maroon-deep: #3D0017;
	--c-red: #FF291F;
	--c-on-red: #0E1F1A; /* text on brand red: 4.55:1 (forest is 3.37:1) */
	--c-red-light: #FF6B61; /* brand red for small text on forest/maroon: 4.5:1+ */
	--c-red-text: #B8150D; /* darkened from #C8170E for 4.5:1 on sand */
	--c-line: #D8D5D0;
	--c-white: #FFFFFF;
	--c-black: #000000;
	--c-won: #4A7333; /* darkened from #5C8841 for 4.5:1 with cream text */
	--c-ongoing: #CE8D44;
	--c-concluded: #BCC8CD;

	--f-serif: Literata, Georgia, "Times New Roman", serif;
	--f-sans: "Instrument Sans", -apple-system, "Helvetica Neue", Arial, sans-serif;

	--gutter: calc(72 * var(--u));
	--container: 1776px;
	--container-narrow: 1040px;
	--header-h: calc(132 * var(--u));

	--t-display: calc(80 * var(--u));
	--t-h1: calc(64 * var(--u));
	--t-h2: calc(56 * var(--u));
	--t-h3: calc(36 * var(--u));
	--t-h4: calc(28 * var(--u));
	--t-lead: calc(24 * var(--u));
	--t-body: max(17px, calc(20 * var(--u)));
	--t-small: max(15px, calc(17 * var(--u)));
	--t-label: max(13px, calc(16 * var(--u)));

	--btn-h: max(52px, calc(80 * var(--u)));
	--ease: cubic-bezier(.2, .7, .2, 1);
}

@media (max-width: 781px) {
	:root {
		--u: 1px;
		--gutter: 20px;
		--header-h: 92px;
		--t-display: 44px;
		--t-h1: 40px;
		--t-h2: 34px;
		--t-h3: 26px;
		--t-h4: 22px;
		--t-lead: 18px;
		--t-body: 17px;
		--btn-h: 60px;
	}
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: var(--header-h); }
body {
	margin: 0;
	font-family: var(--f-serif);
	font-size: var(--t-body);
	line-height: 1.55;
	color: var(--c-forest);
	background: var(--c-cream);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--c-red-text); }
button { font: inherit; color: inherit; cursor: pointer; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
figure { margin: 0; }

h1, h2, h3, h4, h5, h6 {
	font-family: var(--f-serif);
	font-weight: 300;
	line-height: 1.12;
	letter-spacing: -0.01em;
	margin: 0 0 .5em;
	text-wrap: balance;
	overflow-wrap: break-word;
}
h1, .t-h1 { font-size: var(--t-h1); }
h2, .t-h2 { font-size: var(--t-h2); }
h3, .t-h3 { font-size: var(--t-h3); }
h4, .t-h4 { font-size: var(--t-h4); }
.t-display { font-size: var(--t-display); font-weight: 300; line-height: 1.05; }
.t-lead { font-size: var(--t-lead); font-style: italic; line-height: 1.5; }
.t-italic { font-style: italic; }

/* Small uppercase sans label (eyebrows, nav, footer headings). */
.t-label, .eyebrow {
	font-family: var(--f-sans);
	font-size: var(--t-label);
	font-weight: 500;
	letter-spacing: .04em;
	text-transform: uppercase;
	line-height: 1.3;
}

.screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link:focus {
	position: fixed !important; top: 8px; left: 8px; z-index: 1000; width: auto; height: auto; margin: 0;
	clip: auto; padding: 12px 18px; background: var(--c-white); color: var(--c-forest); font-family: var(--f-sans);
}
:focus-visible { outline: 2px solid var(--c-red); outline-offset: 3px; }

/* ---------- Layout ---------- */
.container { width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; }
.container--narrow { --container: var(--container-narrow); }
.container--full { width: 100%; }

.ccf-section { position: relative; padding-block: var(--wp--preset--spacing--60); background-size: cover; background-position: center; }
.ccf-section.is-style-narrow .container { --container: var(--container-narrow); }
.ccf-section.is-style-full .container { width: 100%; }

/* Text colour follows the background picked in the Styles tab. */
.has-forest-background-color, .has-forest-deep-background-color, .has-maroon-background-color, .has-black-background-color { color: var(--c-cream); }
.has-forest-background-color a:hover, .has-forest-deep-background-color a:hover, .has-maroon-background-color a:hover, .has-black-background-color a:hover { color: var(--c-tan); }

/* ---------- Buttons ---------- */
.btn, .wp-block-button__link {
	display: inline-flex; align-items: center; justify-content: center; gap: .6em;
	min-height: var(--btn-h);
	padding: 0 calc(48 * var(--u));
	min-width: calc(200 * var(--u));
	border: 0; border-radius: 0;
	font-family: var(--f-sans); font-size: var(--t-label); font-weight: 600;
	letter-spacing: .04em; text-transform: uppercase; text-decoration: none; text-align: center;
	background: var(--c-red); color: var(--c-on-red);
	transition: background-color .2s var(--ease), color .2s var(--ease);
}
.btn:hover, .wp-block-button__link:hover { background: var(--c-forest); color: var(--c-cream); }
.btn--tan { background: var(--c-tan); color: var(--c-forest); }
.btn--forest { background: var(--c-forest); color: var(--c-cream); }
.btn--forest:hover { background: var(--c-red); color: var(--c-on-red); }
.btn--outline { background: transparent; color: inherit; box-shadow: inset 0 0 0 1px currentColor; }
.btn--outline:hover { background: var(--c-forest); color: var(--c-cream); box-shadow: none; }
.has-forest-background-color .btn:hover, .has-forest-background-color .wp-block-button__link:hover,
.has-forest-deep-background-color .btn:hover, .has-maroon-background-color .btn:hover { background: var(--c-cream); color: var(--c-forest); }

/* Text link with arrow, e.g. "SUBMIT A CASE →". */
.link-arrow {
	display: inline-flex; align-items: center; gap: .5em; min-height: 24px;
	font-family: var(--f-sans); font-size: var(--t-label); font-weight: 500;
	letter-spacing: .04em; text-transform: uppercase; text-decoration: none; color: var(--c-red-text);
}
.link-arrow::after { content: "\2192"; transition: transform .2s var(--ease); }
.link-arrow:hover::after { transform: translateX(4px); }
.has-forest-background-color .link-arrow, .has-forest-deep-background-color .link-arrow, .has-maroon-background-color .link-arrow { color: var(--c-tan); }

/* ---------- Forms ---------- */
.field, .ccf-input,
input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="search"], input[type="number"], textarea, select {
	width: 100%;
	min-height: var(--btn-h);
	padding: 0 calc(20 * var(--u));
	border: 0; border-radius: 0;
	background: var(--c-white); color: var(--c-forest);
	font-family: var(--f-serif); font-size: var(--t-body);
}
textarea { padding-block: calc(20 * var(--u)); min-height: 10em; }
::placeholder { font-family: var(--f-serif); font-style: italic; color: inherit; opacity: .75; }

/* Email + button in one row (hero petition, donate bar). Stacks on phones. */
.inline-form { display: flex; width: 100%; }
.inline-form > input { flex: 1 1 auto; min-width: 0; }
.inline-form > .btn, .inline-form > button { flex: 0 0 auto; }
.inline-form--dark > input { background: var(--c-forest-deep); color: var(--c-cream); }
@media (max-width: 781px) {
	.inline-form { flex-direction: column; gap: 8px; }
	.inline-form > .btn, .inline-form > button { width: 100%; }
}

/* ---------- Utilities ---------- */
.u-hide-mobile { }
@media (max-width: 781px) { .u-hide-mobile { display: none !important; } }
@media (min-width: 782px) { .u-hide-desktop { display: none !important; } }

/* Editor-only placeholder shown for empty sections. */
.ccf-placeholder {
	display: flex; align-items: center; justify-content: center; min-height: 6rem; padding: 1.5rem;
	border: 2px dashed #c3c4c7; color: #646970; background: rgba(255, 255, 255, .5);
	font-family: var(--f-sans); font-size: 15px;
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Editor stand-in for the email field (inline-form). */
.inline-form__field {
	flex: 1 1 auto; display: flex; align-items: center; min-height: var(--btn-h); padding: 0 calc(20 * var(--u));
	background: var(--c-white); color: var(--c-forest); font-style: italic; opacity: .9;
}
.inline-form--dark .inline-form__field { background: var(--c-forest-deep); color: var(--c-cream); }

/* Maroon sections carry the angled pattern from the design. */
.ccf-section.has-maroon-background-color { background-image: url(../images/pattern-maroon.svg); background-size: cover; background-position: center; }
