/*
@todo review env() function for browser safe areas https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/env
 */

:root {
	--Colors-Brand-Primary: #69B3E7;
	--Colors-Brand-Secondary: #002E6D;

	--Colors-Secondary-Accent01: #97D700;
	--Colors-Secondary-Accent02: #154734;
	--Colors-Secondary-Accent03: #00C389;

	--Colors-Error: #FF3A3A;
	--Colors-Muted: #4D6D99;

	--Content-BackgroundColor: #00204C;
	--Content-MaxWidth: 1440px;
	--ReadableContent-MaxWidth: 640px;

	/*
	Fonts
	 */
	--Typeface-FontItal: 0;
	--Typeface-FontWght: 400;

	--Typeface01-FontFamily: "degular-variable", sans-serif;
	--Typeface02-FontFamily: var(--Typeface01-FontFamily);
	--Typeface03-FontFamily: "Poppins", sans-serif;

	--Viewport-InlinePadding: 24px;

	--AnchorTargetBlankIcon-Size: 0.833em;

	--Header-Height: 85px;

	/*
	Interactions
	 */
	--InteractiveFocusVisible-BoxShadow: 0 0 8px var(--Colors-Brand-Primary);
	--InteractiveTransitionDuration: 0.25s;
}

*, *:before, *:after {
	/* by putting these in "*" any selector can update FontItal or FontWght and not have to redefine FontVariationSettings */
	/* opsz values: Degular Text: 6, Degular: 14, Degular Display: 72 */
	--Typeface01-FontVariationSettings: "ital" var(--Typeface-FontItal, 0), "opsz" 14, "wght" var(--Typeface-FontWght);
	--Typeface02-FontVariationSettings: "ital" var(--Typeface-FontItal), "opsz" 72, "wght" var(--Typeface-FontWght);

	box-sizing: inherit;
}

html,
body {
	display: flex;
}

html {
	box-sizing: border-box;
	color-scheme: dark;
	font-family: var(--Typeface03-FontFamily);
	min-height: 100%;
}

/* Smooth page scrolling (jump links, and focusing a form's first invalid field), unless the
   visitor asks for reduced motion. */
@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior:               smooth;
	}
}

body {
	/* Decoded from Sketch's SVG export of the Homepage Background instance (r 1.076476,
	   aspectRatio 1.8942, 375px frame): ry = r * 375, rx = aspectRatio * ry. Absolute
	   radii keep the gradient one fixed size at every browser size. Its final stop
	   matches --Content-BackgroundColor, which continues past it.
	   See ai-docs/sketch-gotchas/gradients-to-css.md — do not translate as a circle.

	   Lives on body rather than main so the header and footer share the same
	   background rather than sitting on bare black; the site design is now unified
	   rather than main being the only themed region. */
	background-color: var(--Content-BackgroundColor);
	background-image: radial-gradient(ellipse 765px 404px at 52.61% -97px, #00C389 0%, #005BA6 39.08%, #002E6D 75.02%, #00204C 100%);
	color: #ffffff;
	flex: 1 1 100%;
	flex-direction: column;
	margin: 0;
	padding: 0 0 env(safe-area-inset-bottom);
	width: 100%;
}

main {
	/* A consistent minimum gap below the header, so every page starts the same
	   distance down rather than each page picking its own (or none). Pages that
	   need more space of their own reduce their own top margin/padding by this
	   amount rather than adding to it, so the two don't stack. */
	flex: 1 1 auto;
	padding-top: 24px;
}

/*
Basic Elements
 */
h1, h2, h3, h4, h5, h6, p {
	margin-top: unset;
}

h1, h2, h3, h4, h5, h6 {
	--Typeface-FontWght: 700;

	font-family: var(--Typeface01-FontFamily);
	font-variation-settings: var(--Typeface01-FontVariationSettings);
	font-weight: var(--Typeface-FontWght);
}

a {
	color:                         var(--Colors-Brand-Primary);
}

/*
The external link marker is masked rather than embedded, so one rule covers every
_blank anchor and the icon still takes its colour from the link via currentColor.
 */
a[target="_blank"]::after {
	background-color: currentColor;
	content: "";
	display: inline-block;
	height: var(--AnchorTargetBlankIcon-Size);
	margin-left: 8px;
	mask: url("/Images/IconAnchorTargetBlank.svg") no-repeat center / contain;
	vertical-align: -0.125em;
	width: var(--AnchorTargetBlankIcon-Size);
}

/*
Buttons

Split three ways so a control takes only what it needs:

  .FEButton         structure, plus the --ThisButton* contract it reads. No palette
                    colours of its own.
  state rules       :hover / :focus-visible / :active / :disabled, reading the contract.
                    Each falls back to the resting token, so a palette that defines no
                    hover simply keeps its resting appearance.
  .FEButtonPrimary  palette — Buttons/Primary Button in Sketch.
  .FEButtonOutline  palette — Buttons/Outline Button in Sketch.

Markup pairs a structure class with a palette class:

  class="FEButton FEButtonPrimary"

A page-level class can override individual tokens on top of a palette; it wins because
page stylesheets load after Base.css.

Controls that are not text buttons should read the contract rather than take .FEButton,
whose box model (min-height, padding, typography) is specific to text buttons. See
.FEIconButton below.
 */
.FEButton {
	--Typeface-FontWght: 700;

	/* Shape — shared by every palette. */
	--ThisButton-BorderRadiusLength:                 12px;
	--ThisButton-BorderStyle:                        solid;
	--ThisButton-BorderWidth:                        1px;

	/* Focus indicator and disabled treatment are palette-agnostic. */
	--ThisButtonDisabled-BackgroundColor:            #919191;
	--ThisButtonDisabled-BorderColor:                var(--ThisButton-BorderColor, transparent);
	--ThisButtonDisabled-Color:                      #CCCCCC;
	--ThisButtonFocusVisible-BoxShadow:              var(--InteractiveFocusVisible-BoxShadow);

	align-items:                   center;
	appearance:                    none;
	background-color:              var(--ThisButton-BackgroundColor, #ffffff);
	border:                        var(--ThisButton-BorderWidth, 1px) var(--ThisButton-BorderStyle, solid) var(--ThisButton-BorderColor, transparent);
	border-radius:                 12px;
	box-shadow:                    none;
	color:                         var(--ThisButton-Color);
	cursor:                        pointer;
	display:                       inline-flex;
	font-family:                   var(--Typeface01-FontFamily);
	font-size:                     18px;
	font-variation-settings:       var(--Typeface01-FontVariationSettings);
	font-weight:                   var(--Typeface-FontWght);
	gap:                           8px;
	justify-content:               center;
	line-height:                   1;
	min-height:                    60px;
	padding:                       0.25em 1em;
	position:                      relative;
	text-align:                    center;
	text-decoration:               var(--ThisButton-TextDecoration, none);
	text-transform:                none;
	transition:                    var(--InteractiveTransitionDuration);
	z-index:                       1;
}

.FEButton:hover {
	background-color:              var(--ThisButtonHover-BackgroundColor, var(--ThisButton-BackgroundColor));
	border-color:                  var(--ThisButtonHover-BorderColor, var(--ThisButton-BorderColor));
	color:                         var(--ThisButtonHover-Color, var(--ThisButton-Color));
}

.FEButton:focus-visible {
	background-color:              var(--ThisButtonFocusVisible-BackgroundColor, var(--ThisButton-BackgroundColor));
	border-color:                  var(--ThisButtonFocusVisible-BorderColor, var(--ThisButton-BorderColor));
	box-shadow:                    var(--ThisButtonFocusVisible-BoxShadow);
	color:                         var(--ThisButtonFocusVisible-Color, var(--ThisButton-Color));
	outline:                       none;
}

.FEButton:active {
	background-color:              var(--ThisButtonActive-BackgroundColor, var(--ThisButton-BackgroundColor));
	border-color:                  var(--ThisButtonActive-BorderColor, var(--ThisButton-BorderColor));
	color:                         var(--ThisButtonActive-Color, var(--ThisButton-Color));
}

.FEButton:disabled {
	background-color:              var(--ThisButtonDisabled-BackgroundColor);
	border-color:                  var(--ThisButtonDisabled-BorderColor);
	color:                         var(--ThisButtonDisabled-Color);
	cursor:                        not-allowed;
}

/*
Primary palette — Buttons/Primary Button in Sketch. The default treatment.
 */
.FEButtonPrimary {
	--ThisButton-BackgroundColor:                    #ffffff;
	--ThisButton-BorderColor:                        transparent;
	--ThisButton-Color:                              #191919;

	--ThisButtonHover-BackgroundColor:               #E1F0FA;
	--ThisButtonHover-BorderColor:                   var(--ThisButton-BorderColor);
	--ThisButtonHover-Color:                         var(--ThisButton-Color);

	--ThisButtonFocusVisible-BackgroundColor:        var(--ThisButton-BackgroundColor);
	--ThisButtonFocusVisible-BorderColor:            var(--ThisButton-BorderColor);
	--ThisButtonFocusVisible-Color:                  var(--ThisButton-Color);

	--ThisButtonActive-BackgroundColor:              #B4D9F3;
	--ThisButtonActive-BorderColor:                  var(--ThisButton-BorderColor);
	--ThisButtonActive-Color:                        var(--ThisButton-Color);
}

/*
Outline palette — Buttons/Outline Button in Sketch. For the dark page and menu
backgrounds.
 */
.FEButtonOutline {
	--ThisButton-BackgroundColor:                    transparent;
	--ThisButton-BorderColor:                        #ffffff;
	--ThisButton-BorderWidth:                        2px;
	--ThisButton-Color:                              #ffffff;

	--ThisButtonHover-BackgroundColor:               rgb(255 255 255 / 0.25);
	--ThisButtonHover-BorderColor:                   var(--ThisButton-BorderColor);
	--ThisButtonHover-Color:                         var(--ThisButton-Color);

	--ThisButtonFocusVisible-BackgroundColor:        var(--ThisButton-BackgroundColor);
	--ThisButtonFocusVisible-BorderColor:            var(--ThisButton-BorderColor);
	--ThisButtonFocusVisible-Color:                  var(--ThisButton-Color);

	--ThisButtonActive-BackgroundColor:              #ffffff;
	--ThisButtonActive-BorderColor:                  var(--ThisButton-BorderColor);
	--ThisButtonActive-Color:                        var(--Colors-Brand-Secondary);
}

/*
Icon Button

For controls that are not text buttons — a bare 24px icon in a 40px hit area. Promoted
from Navigation.css's .NavigationActionButton, which had the same rule under a
panel-specific name; see HeaderInner.tpl's open button and Navigation.tpl's close
button for the two call sites. States follow Buttons/Outline Button in Sketch with no
border drawn: a white wash on hover, a solid white fill with a Brand Secondary icon on
active, and the shared focus glow.

Colours are hardcoded rather than tokenised because every surface this appears on today
is dark. A light-surface instance should get its own --ThisIconButton* prefix rather than
reusing --ThisButton*, which is reserved for .FEButton.
 */
.FEIconButton {
	align-items:                   center;
	appearance:                    none;
	background-color:              transparent;
	border:                        none;
	border-radius:                 12px;
	color:                         #ffffff;
	cursor:                        pointer;
	display:                       flex;
	height:                        40px;
	justify-content:               center;
	padding:                       0;
	transition:                    var(--InteractiveTransitionDuration);
	width:                         40px;
}

.FEIconButton:hover {
	background-color:              rgb(255 255 255 / 0.25);
}

.FEIconButton:active {
	background-color:              #ffffff;
	color:                         var(--Colors-Brand-Secondary);
}

.FEIconButton:focus-visible {
	box-shadow:                    var(--InteractiveFocusVisible-BoxShadow);
	outline:                       none;
}

.FEIconButtonIcon {
	height:                        24px;
	width:                         24px;
}

.ButtonIcon {
	aspect-ratio:                  1 / 1;
}

/*
Masked rather than an <img> so the icon takes the button's colour through every palette
and state, instead of needing an asset per treatment. The mask reads shape only, so the
fill in the source file is irrelevant. This stands in for the SVG auto-inlining the PHP
engine did; Turbo has no equivalent yet.
 */
.ButtonIconLink {
	background-color:              currentColor;
	mask:                          url("/Images/IconLink.svg") no-repeat center / contain;
	width:                         16px;
}

/*
Page Buttons
 */
.PageButtons {
	padding-inline: var(--Viewport-InlinePadding);
}

.PageButtonsInner {
	display: flex;
	flex-direction: column;
	gap: 24px 17px;
	margin-inline: auto;
	max-width: calc(var(--ReadableContent-MaxWidth));
}

.PageButton {
	flex: 1 1 auto;
}

/*
Form
 */
input:is([type=radio], [type=checkbox]),
label[for] {
	cursor: pointer;
}

input,
select,
textarea {
	font: inherit;
	transition: 0.25s;
}

.FormRow {
	display: flex;
	gap: 24px 17px;
}

.FormField {
	flex: 1 1 100%;
	position: relative;
}

.FormRow:has(> .FormField:nth-child(2):last-child) .FormField {
	flex-basis: 50%;
}

.FormFieldLabel {
	font-size: 14px;
	line-height: 18px;
}

.FormFieldLabel:has(+ input, + .FormFieldSelectWrapper) {
	display: flex;
	gap: 4px;
	margin-bottom: 2px;
}

.FormFieldRequired {
	color: var(--Colors-Error);
	content: " *";
	order: 10;
}

.FormFieldInputArea {
	position: relative;
}

.FormFieldInput:user-invalid,
.FormFieldInput[aria-invalid="true"] {
	outline: 1px solid var(--Colors-Error);
}

/*
Text inputs: any input that accepts any form of text. This is the structure; the Sketch
"Form/Text Field" colour states follow.
 */
.FormFieldTextInput {
	border:                        none;
	border-radius:                 8px;
	color:                         inherit;
	font-size:                     16px;
	height:                        56px;
	outline:                       1px solid transparent;
	padding:                       8px 16px 4px;
	transition:                    var(--InteractiveTransitionDuration);
	width:                         100%;
}

/*
Text field states: Sketch "Form/Text Field".

	resting      #1A437C, placeholder #CCD5E2, text white
	filled       the same #1A437C (Sketch updated, 2026-11-09). A read-only value is the
	             "Filled (static)" symbol, #002E6D, drawn as a box rather than a field
	             (.SlugPreview in CreateEvent.css)
	:hover       #33588A
	:focus       #1A437C with an 8px #69B3E7 glow (the symbol's 4 blur)
	:active      #33588A with a 1px inside #69B3E7 border (mouse down)
	error        1px inside #EE0B0B border: aria-invalid, which CFormValidator sets while its
	             message shows, or the browser's :user-invalid

The borders are inset box-shadows, so no state changes the field's size.
 */
.FormFieldTextInput {
	background-color:              #1A437C;
	color:                         #ffffff;
	outline:                       none;
}

.FormFieldTextInput::placeholder {
	color:                         #CCD5E2;
}

.FormFieldTextInput:hover {
	background-color:              #33588A;
}

.FormFieldTextInput:focus {
	background-color:              #1A437C;
	box-shadow:                    0 0 8px #69B3E7;
}

.FormFieldTextInput:active {
	background-color:              #33588A;
	box-shadow:                    inset 0 0 0 1px #69B3E7;
}

.FormFieldTextInput:is([aria-invalid="true"], :user-invalid) {
	box-shadow:                    inset 0 0 0 1px #EE0B0B;
}

.FormFieldTextInput:is([aria-invalid="true"], :user-invalid):focus {
	box-shadow:                    inset 0 0 0 1px #EE0B0B, 0 0 8px #69B3E7;
}

/*
Selects (Templates/Form/StateSelect.tpl): Sketch "Form/Dropdown". The select carries
.FormFieldTextInput, so it takes the text field states above; the browser's arrow is replaced by
the 24px "Icon/Downward Arrow" chevron, 16px from the right, as a mask in the text colour. The
empty first option shows in the placeholder colour.
 */
.FormFieldSelectWrapper {
	position:                      relative;
}

.FormFieldSelectWrapper::after {
	background-color:              #ffffff;
	content:                       "";
	height:                        24px;
	mask:                          url(/Images/IconChevronDown.svg) center / contain no-repeat;
	pointer-events:                none;
	position:                      absolute;
	right:                         16px;
	top:                           calc(50% - 12px);
	width:                         24px;
}

.FormFieldSelect {
	appearance:                    none;
	cursor:                        pointer;
	padding-right:                 48px;
}

.FormFieldSelect:has(option[value=""]:checked) {
	color:                         #CCD5E2;
}

.FormFieldSelect option {
	background-color:              #002E6D;
	color:                         #ffffff;
}

/*
Amount inputs: the big "$ 0" field inside .FormRowPledgeAmount (the shared Pledge Amount field in
CSS/PledgeAmount.css, and the donate form) is an underline, not a box. This takes the box states
above back off. The state list matches the rules above in specificity, and this comes after them,
so it wins in every state.
 */
.FormRowPledgeAmount .FormFieldTextInput,
.FormRowPledgeAmount .FormFieldTextInput:is(:hover, :focus, :active, [aria-invalid="true"], :user-invalid) {
	background-color:              transparent;
	box-shadow:                    none;
}

/*
Checkboxes: Sketch "Checkbox/Selector" (a box beside a label; the label may be a bold title with a
description under it) and "Checkbox/Box" (16x16, 4px radius, text at x28). Sketch puts the box at
y+4 of the 24px title line, which renders low against the browser's text, so the box sits 2px down.
It stays the real <input type="checkbox"> (appearance: none), so it keeps its semantics and
keyboard operation. Default #1A437C with a 1px inside #33588A border; hover #33588A with a #69B3E7
border (hovering the row counts, as in the Selector symbols); checked #69B3E7 with the navy
checkmark; keyboard focus adds a 5px #69B3E7 glow (the symbol's 2.5 blur).
 */
.FormFieldForCheckBox {
	align-items:                   start;
	display:                       flex;
	gap:                           0 12px;
}

.FormFieldCheckbox {
	appearance:                    none;
	background-color:              #1A437C;
	background-position:           center;
	background-repeat:             no-repeat;
	border:                        1px solid #33588A;
	border-radius:                 4px;
	box-sizing:                    border-box;
	flex:                          0 0 16px;
	height:                        16px;
	margin:                        2px 0 0;
	width:                         16px;
}

.FormFieldForCheckBox:hover .FormFieldCheckbox:not(:checked) {
	background-color:              #33588A;
	border-color:                  #69B3E7;
}

.FormFieldCheckbox:checked {
	background-color:              #69B3E7;
	background-image:              url("/Images/IconCheckmarkThemeBrandSecondary.svg");
	border-color:                  #69B3E7;
}

.FormFieldCheckbox:focus-visible {
	box-shadow:                    0 0 5px #69B3E7;
	outline:                       none;
}

/*
Two-part label content (a bold title and a description), read off the exported SVG
(fontSize/fontWeight are null via the JS API for these shared styles).
 */
.FormFieldLabelText:has(> .CheckboxTitle) {
	display:                       flex;
	flex-direction:                column;
	gap:                           5px;
}

.CheckboxTitle {
	color:                         #ffffff;
	font-size:                     16px;
	font-weight:                   700;
	line-height:                   24px;
}

.CheckboxDescription {
	color:                         #ccd5e2;
	font-size:                     14px;
	font-weight:                   500;
	line-height:                   18px;
}

/* The privacy link is underlined; a[target="_blank"]::after adds the new-tab icon. */
.CheckboxDescription a {
	text-decoration:               underline;
}

.FormFieldErrorMessage {
	--Typeface-FontWght:           500;
	color:                         var(--Colors-Error);
	font-size:                     12px;
	font-weight:                   var(--Typeface-FontWght);
	line-height:                   12px;
	margin-top:                    5px;
	position:                      absolute;
	right:                         0;
	text-align:                    right;
	top:                           100%;
}

.FormErrorMessages {
	--Typeface-FontWght: 500;

	color: var(--Colors-Error);
	font-size: 12px;
	font-weight: var(--Typeface-FontWght);
	line-height: 12px;
	overflow: visible;
}

/*
Toast
 */
#ToastDialog {
	--Typeface-FontWght: 500;
	background: var(--Colors-Brand-Primary);
	border-radius: 22px;
	bottom: calc(env(safe-area-inset-bottom) + 24px);
	color: var(--Colors-Brand-Secondary);
	font-size: 14px;
	font-weight: var(--Typeface-FontWght);
	left: 50%;
	line-height: 18px;
	max-width: calc(100vw - var(--Viewport-InlinePadding));
	min-width: 212px;
	opacity: 0;
	padding: 12px 22px 8px;
	position: fixed;
	text-align: center;
	transform: translateX(-50%);
	transition: opacity 0.25s, z-index 0s;
	transition-delay: 0s, 0.25s; /* delay z-index when .Open is removed */
	z-index: -200;
}

#ToastDialog.ThemeError {
	background: var(--Colors-Error);
	color: #ffffff;
}

#ToastDialog.Open {
	opacity: 1;
	transition-delay: 0s, 0s; /* z-index should be instant when .Open is added */
	z-index: 200;
}

#ToastDialog a {
	color: inherit;
	text-decoration: none;
}

.TCExternalLink, .TCExternalLinkText {
	display: inline-block;
	font-size: 12px;
	/*text-decoration: none;*/
}
/*
Draft Preview Banner - the top of a Draft challenge's or campaign's preview (Pages/challenge.tpl,
campaign.tpl). No design; a dashed outline in the brand blue, so it reads as a label, not content.
 */
.DraftPreviewBanner {
	--Typeface-FontWght:           700;
	border:                        1px dashed var(--Colors-Brand-Primary);
	border-radius:                 12px;
	color:                         var(--Colors-Brand-Primary);
	font-family:                   var(--Typeface01-FontFamily);
	font-size:                     16px;
	font-variation-settings:       var(--Typeface01-FontVariationSettings);
	font-weight:                   var(--Typeface-FontWght);
	line-height:                   20px;
	margin:                        8px 0 16px;
	padding:                       10px 16px 8px;
	text-align:                    center;
}
