@font-face {
	font-family: "Charitable Digital";
	src: url("../../fonts/charitable-digital.woff2") format("woff2");
	font-weight: normal;
	font-style: normal;
	font-display: swap;
}

.charitable-countdown {
	display: inline-block;
	max-width: 100%;
	line-height: 1.2;
	/* The container carries the --ccd-* custom properties inline, so its style
	   attribute contains the substring "border-color". WordPress's block border
	   support injects `:where([style*="border-color"]) { border-style: solid }`,
	   which would otherwise draw a stray border around the whole countdown. The
	   border belongs on the unit tiles, never the container — assert that here.
	   A class selector outranks WP's zero-specificity :where() rule. */
	border-style: none;
}

.charitable-countdown--align-left   { text-align: left; }
.charitable-countdown--align-center { text-align: center; display: block; }
.charitable-countdown--align-right  { text-align: right; display: block; }

.charitable-countdown__headline {
	font-weight: 600;
	margin-bottom: 0.5em;
}

/* Campaign Builder live preview simulates the headline link with a CSS
   class rather than wrapping in an <a> tag, to keep the preview DOM
   stable across re-renders. Harmless on the frontend — the template
   uses a real anchor there, and this class is not applied by PHP. */
.charitable-countdown__headline--linked {
	text-decoration: underline;
	cursor: pointer;
}

.charitable-countdown__end-date {
	font-size: 0.9em;
	opacity: 0.75;
	margin: 0.5em 0;
}

/* Boxed style */
.charitable-countdown--style-boxed .charitable-countdown__units {
	display: inline-flex;
	gap: 0.5em;
	align-items: flex-start;
}

.charitable-countdown--style-boxed .charitable-countdown__unit {
	display: flex;
	flex-direction: column;
	align-items: center;
	min-width: 3.5em;
	padding: 0.4em 0.6em;
	/* Fallbacks match Charitable_Countdown::defaults() so unit boxes look
	   right even when no inline style is emitted (build_inline_style()
	   skips emitting CSS vars for values that match the canonical default,
	   so the stylesheet fallback must agree with that default). */
	background: var(--ccd-bg-color, transparent);
	color: var(--ccd-number-color, #222);
	border: var(--ccd-border-size, 1px) solid var(--ccd-border-color, #222);
	border-radius: var(--ccd-border-radius, 6px);
}

.charitable-countdown--style-boxed .charitable-countdown__number {
	font-size: var(--ccd-number-size, 2em);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.charitable-countdown--style-boxed .charitable-countdown__label {
	font-size: var(--ccd-label-size, 0.7em);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin-top: 0.25em;
}

/* Inline style */
.charitable-countdown--style-inline .charitable-countdown__units {
	display: inline;
}

.charitable-countdown--style-inline .charitable-countdown__unit {
	display: inline;
	margin-right: 0.35em;
}

.charitable-countdown--style-inline .charitable-countdown__number {
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.charitable-countdown--style-inline .charitable-countdown__label {
	font-weight: normal;
}

/* Digital font — numbers only */
.charitable-countdown--digital .charitable-countdown__number {
	font-family: "Charitable Digital", ui-monospace, Menlo, monospace;
	letter-spacing: 0.05em;
}

/* Expired state */
.charitable-countdown__expired-message {
	margin-top: 0.5em;
	font-weight: 600;
}

.charitable-countdown__units[data-state="expired"] .charitable-countdown__unit {
	opacity: 0.6;
}

[hidden] { display: none !important; }

/* Reduced motion — skip any CSS-driven emphasis */
@media (prefers-reduced-motion: reduce) {
	.charitable-countdown__unit { transition: none !important; }
}

/* CSS variable overrides — applied via inline style by the Campaign Builder
   field. Fallbacks match Charitable_Countdown::defaults() (dark text on
   transparent tiles) so a saved field whose colours match the default
   doesn't need to emit inline overrides at all. */
.charitable-countdown__number { color: var(--ccd-number-color, #222); font-size: var(--ccd-number-size, inherit); }
.charitable-countdown__label  { color: var(--ccd-label-color, #222);  font-size: var(--ccd-label-size, inherit); }

/* Gutenberg block-level alignment — our timer is display:inline-block, so we
   translate WP's align classes into text-align on the block wrapper so the
   inline-block timer centers / aligns correctly. */
.wp-block-charitable-campaign-countdown.aligncenter { text-align: center; }
.wp-block-charitable-campaign-countdown.alignleft   { text-align: left; }
.wp-block-charitable-campaign-countdown.alignright  { text-align: right; }

/* Alignment field — builder-ui-general.css forces
   `.charitable-panel-field-align { display: none !important }` globally.
   Override for our countdown settings only, when the field is active. */
.charitable-countdown-settings .charitable-panel-field-align.active {
	display: block !important;
}

/* Campaign Builder field: Show Units — one row of 4 inline-block checkboxes
   at 25% each. Force display:block on the outer panel-field to override the
   builder's default display:table, and 25% width on each <p>. */
.charitable-countdown-units-grid.active {
	display: block !important;
}
.charitable-countdown-settings .charitable-countdown-units-grid > label {
	display: block !important;
	width: 100%;
	margin-bottom: 8px;
}
.charitable-countdown-units-grid > p {
	display: inline-block !important;
	width: 25% !important;
	vertical-align: top;
	box-sizing: border-box;
	margin: 5px 0 !important;
	line-height: 14px !important;
}

/* Countdown settings panel overrides — scoped to the countdown field's
   settings_display() wrapper so global builder rules stay intact.
   Builder default: .charitable-panel-field-toggle has margin-bottom: 0.
   Restore visible spacing for toggle rows inside the countdown settings. */
.charitable-countdown-settings .charitable-panel-field-toggle {
	margin-bottom: 20px !important;
}

/* Sizing section 2-column grid — wrapper is a .charitable-panel-field so the
   builder's per-field hide/show logic applies. When active, the builder's
   `.charitable-panel-field.active { display: block }` rule would beat our
   display:grid, so we bump specificity via .active and !important. When
   inactive, builder's `display: none` still wins (our rule doesn't match). */
.charitable-countdown-settings .charitable-countdown-sizing-grid {
	grid-template-columns: repeat(2, 1fr);
	gap: 1rem 1rem;
	width: 95%;
	margin-bottom: 20px;
}
.charitable-countdown-settings .charitable-countdown-sizing-grid.active {
	display: grid !important;
}
.charitable-countdown-settings .charitable-countdown-sizing-grid > .charitable-panel-field.charitable-panel-field-text {
	display: block;
	width: 100%;
	max-width: 100%;
	margin-bottom: 0;
}
.charitable-countdown-settings .charitable-countdown-sizing-grid input[type="number"] {
	width: 100%;
	box-sizing: border-box;
}

/* Countdown Colors section — markup is produced by
   Charitable_Builder_Form_Fields::generate_coloris_group(). The field
   settings panel pulls in `.charitable-panel-field` cascades from
   builder-ui-general.css that force inputs to 100% width and labels to
   block display. These scoped rules force the Theme-Colors-style row
   layout (label | swatch | hex input) regardless of those cascades. */
.charitable-countdown-settings .charitable-countdown-colors-group {
	margin-bottom: 20px;
	width: 95%;
}
.charitable-countdown-colors-group .coloris-layout {
	max-width: none !important;
	width: 100% !important;
	margin-top: 2px;
	margin-bottom: 2px;
	display: flex !important;
	flex-direction: row;
	flex-wrap: nowrap;
	justify-content: space-between;
	align-items: center;
}
.charitable-countdown-colors-group .coloris-layout > label {
	display: inline-block !important;
	margin: 0 !important;
	line-height: 26px;
	font-size: 13px;
	flex: 0 0 auto;
}
.charitable-countdown-colors-group .coloris-layout input[type="text"] {
	width: 100px !important;
	height: 32px;
	padding: 0 10px 0 10px;
	border: 1px solid #ccc;
	border-radius: 5px;
	font-family: inherit;
	font-size: inherit;
	font-weight: inherit;
	box-sizing: border-box;
	margin: 2px 0;
}
