| 1 |
<?php |
| 2 |
/** |
| 3 |
* Template-agnostic base CSS for the Campaign Hero block. |
| 4 |
* |
| 5 |
* The Campaign Hero block can be dragged into a campaign built on *any* template, but |
| 6 |
* the bespoke hero choreography lives in `beacon-hero.php`, scoped to |
| 7 |
* `.charitable-campaign-wrap.template-beacon-*`. Without this partial, a hero on any |
| 8 |
* other template renders with an unstyled `__banner` — which is absolutely positioned |
| 9 |
* and therefore collapses to `height: 0`, making the background image invisible. |
| 10 |
* |
| 11 |
* This file supplies only the structural essentials needed for the hero to be legible |
| 12 |
* on its own: banner fills the section, content sits above it, and the block has height. |
| 13 |
* |
| 14 |
* Deliberately NOT included here are the Beacon-only overlap effects — the avatar's |
| 15 |
* `transform: translateY(...)` overhang and the widget shell's negative |
| 16 |
* `margin-bottom` — because both rely on the following Beacon body row carrying |
| 17 |
* compensating top padding. Applied on templates without that padding they would let |
| 18 |
* the hero overhang whatever follows it. |
| 19 |
* |
| 20 |
* Every selector here is one class less specific than its `beacon-hero.php` |
| 21 |
* counterpart (`.charitable-campaign-wrap` vs |
| 22 |
* `.charitable-campaign-wrap.template-beacon-split`), so on Beacon templates the |
| 23 |
* scoped rules continue to win regardless of source order. |
| 24 |
* |
| 25 |
* Expects (both optional): |
| 26 |
* |
| 27 |
* $mobile_width — responsive breakpoint in px. Defaults to 800 to match the |
| 28 |
* templates' own default when `mw` is absent. |
| 29 |
* |
| 30 |
* @package Charitable |
| 31 |
* @since 1.8.12.1 |
| 32 |
*/ |
| 33 |
|
| 34 |
if ( ! defined( 'ABSPATH' ) ) { |
| 35 |
exit; |
| 36 |
} |
| 37 |
|
| 38 |
$charitable_hero_wrapper = '.charitable-campaign-wrap'; |
| 39 |
$charitable_hero_mobile = isset( $mobile_width ) ? max( 320, min( 2000, intval( $mobile_width ) ) ) : 800; |
| 40 |
?> |
| 41 |
|
| 42 |
/* ── Campaign Hero — template-agnostic base ──────────────────────────── */ |
| 43 |
|
| 44 |
<?php echo $charitable_hero_wrapper; // phpcs:ignore ?> .charitable-campaign-hero { |
| 45 |
position: relative; |
| 46 |
width: 100%; |
| 47 |
min-height: 420px; |
| 48 |
margin: 0; |
| 49 |
display: block; |
| 50 |
} |
| 51 |
|
| 52 |
<?php echo $charitable_hero_wrapper; // phpcs:ignore ?> .charitable-campaign-hero__banner { |
| 53 |
position: absolute; |
| 54 |
inset: 0; |
| 55 |
background-size: cover; |
| 56 |
background-position: center; |
| 57 |
z-index: 1; |
| 58 |
} |
| 59 |
|
| 60 |
<?php echo $charitable_hero_wrapper; // phpcs:ignore ?> .charitable-campaign-hero__overlay { |
| 61 |
position: relative; |
| 62 |
z-index: 2; |
| 63 |
display: grid; |
| 64 |
grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); |
| 65 |
gap: 32px; |
| 66 |
padding: 32px; |
| 67 |
min-height: 420px; |
| 68 |
align-items: end; |
| 69 |
} |
| 70 |
|
| 71 |
<?php echo $charitable_hero_wrapper; // phpcs:ignore ?> .charitable-campaign-hero__identity { |
| 72 |
display: flex; |
| 73 |
align-items: flex-end; |
| 74 |
gap: 20px; |
| 75 |
min-width: 0; |
| 76 |
align-self: end; |
| 77 |
} |
| 78 |
|
| 79 |
<?php echo $charitable_hero_wrapper; // phpcs:ignore ?> .charitable-campaign-hero__avatar { |
| 80 |
width: clamp(105px, 12vw, 157px); |
| 81 |
height: clamp(105px, 12vw, 157px); |
| 82 |
flex-shrink: 0; |
| 83 |
background: #fff; |
| 84 |
border: 1px solid rgba(255, 255, 255, 0.7); |
| 85 |
border-radius: 4px; |
| 86 |
overflow: hidden; |
| 87 |
box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3); |
| 88 |
} |
| 89 |
|
| 90 |
<?php echo $charitable_hero_wrapper; // phpcs:ignore ?> .charitable-campaign-hero__avatar img { |
| 91 |
display: block; |
| 92 |
width: 100%; |
| 93 |
height: 100%; |
| 94 |
object-fit: cover; |
| 95 |
} |
| 96 |
|
| 97 |
<?php echo $charitable_hero_wrapper; // phpcs:ignore ?> .charitable-campaign-hero__title { |
| 98 |
color: #fff; |
| 99 |
font-size: clamp(28px, 3.6vw, 44px); |
| 100 |
font-weight: 700; |
| 101 |
margin: 0 0 16px 0; |
| 102 |
text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); |
| 103 |
flex: 1 1 auto; |
| 104 |
line-height: 1.15; |
| 105 |
} |
| 106 |
|
| 107 |
<?php echo $charitable_hero_wrapper; // phpcs:ignore ?> .charitable-campaign-hero__widget-shell { |
| 108 |
background: #fff; |
| 109 |
border: 1px solid rgba(255, 255, 255, 0.7); |
| 110 |
border-radius: 0; |
| 111 |
overflow: hidden; |
| 112 |
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2); |
| 113 |
position: relative; |
| 114 |
align-self: end; |
| 115 |
} |
| 116 |
|
| 117 |
<?php echo $charitable_hero_wrapper; // phpcs:ignore ?> .charitable-campaign-hero__raised { |
| 118 |
background: var(--charitable-hero-accent, #1d3a8a); |
| 119 |
color: #fff; |
| 120 |
padding: 10px 16px; |
| 121 |
} |
| 122 |
|
| 123 |
<?php echo $charitable_hero_wrapper; // phpcs:ignore ?> .charitable-campaign-hero__raised-text { |
| 124 |
font-size: 13px; |
| 125 |
font-weight: 600; |
| 126 |
margin-bottom: 6px; |
| 127 |
} |
| 128 |
|
| 129 |
<?php echo $charitable_hero_wrapper; // phpcs:ignore ?> .charitable-campaign-hero__progress { |
| 130 |
background: rgba(255, 255, 255, 0.25); |
| 131 |
height: 4px; |
| 132 |
border-radius: 2px; |
| 133 |
overflow: hidden; |
| 134 |
} |
| 135 |
|
| 136 |
<?php echo $charitable_hero_wrapper; // phpcs:ignore ?> .charitable-campaign-hero__progress span { |
| 137 |
display: block; |
| 138 |
height: 100%; |
| 139 |
background: #fff; |
| 140 |
} |
| 141 |
|
| 142 |
<?php echo $charitable_hero_wrapper; // phpcs:ignore ?> .charitable-campaign-hero__widget { |
| 143 |
padding: 14px 16px 16px; |
| 144 |
} |
| 145 |
|
| 146 |
<?php echo $charitable_hero_wrapper; // phpcs:ignore ?> .charitable-campaign-hero__widget .charitable-mini-widget { |
| 147 |
max-width: none; |
| 148 |
width: 100%; |
| 149 |
} |
| 150 |
|
| 151 |
/* Donate Now CTA inside the hero follows the theme Button color (separate from the primary accent). */ |
| 152 |
<?php echo $charitable_hero_wrapper; // phpcs:ignore ?> .charitable-campaign-hero__widget .charitable-mini-widget__cta { |
| 153 |
background-color: var(--charitable-hero-button, var(--charitable-hero-accent, #1d3a8a)); |
| 154 |
} |
| 155 |
|
| 156 |
/* Mobile: stack the hero overlay grid so the widget drops below the identity block. */ |
| 157 |
@media ( max-width: <?php echo intval( $charitable_hero_mobile ); // phpcs:ignore ?>px ) { |
| 158 |
<?php echo $charitable_hero_wrapper; // phpcs:ignore ?> .charitable-campaign-hero__overlay { |
| 159 |
grid-template-columns: 1fr; |
| 160 |
padding: 24px 16px; |
| 161 |
min-height: 320px; |
| 162 |
gap: 16px; |
| 163 |
} |
| 164 |
<?php echo $charitable_hero_wrapper; // phpcs:ignore ?> .charitable-campaign-hero { |
| 165 |
min-height: auto; |
| 166 |
} |
| 167 |
} |
| 168 |
|