@backgold/template-kit 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (340) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +12 -2
  3. package/dist/chunk-KOB36GSF.js +62 -0
  4. package/dist/constants-DvTNj4JI.d-Batjcj3Z.d.ts +38 -0
  5. package/dist/content-api-CYeY0vU8.d.ts +849 -0
  6. package/dist/contract/content-api-examples.d.ts +58 -0
  7. package/dist/contract/content-api-examples.js +783 -0
  8. package/dist/contract/content-api.d.ts +2 -0
  9. package/dist/contract/content-api.js +1 -0
  10. package/dist/contract/site-templates.d.ts +252 -0
  11. package/dist/contract/site-templates.js +185 -0
  12. package/package.json +70 -3
  13. package/src/components/EntryCard.astro +35 -0
  14. package/src/components/EventMap.astro +118 -0
  15. package/src/components/EventPage.astro +194 -0
  16. package/src/components/FieldValue.astro +41 -0
  17. package/src/components/LeadingHero.astro +21 -0
  18. package/src/components/NotFound.astro +20 -0
  19. package/src/components/PageSections.astro +47 -0
  20. package/src/components/Prose.astro +18 -0
  21. package/src/components/chrome/Brand.astro +54 -0
  22. package/src/components/chrome/ClosingCall.astro +94 -0
  23. package/src/components/chrome/DonateStrip.astro +61 -0
  24. package/src/components/chrome/FooterColumns.astro +32 -0
  25. package/src/components/chrome/FooterContact.astro +28 -0
  26. package/src/components/chrome/MenuList.astro +45 -0
  27. package/src/components/chrome/ModeToggle.astro +125 -0
  28. package/src/components/chrome/SignedInNotice.astro +53 -0
  29. package/src/components/chrome/SignupBand.astro +12 -0
  30. package/src/components/chrome/TakeoverBanner.astro +56 -0
  31. package/src/components/chrome/VisitorAccount.astro +82 -0
  32. package/src/components/entries/AuthorBox.astro +47 -0
  33. package/src/components/entries/EntryFields.astro +29 -0
  34. package/src/components/entries/EntryHeader.astro +77 -0
  35. package/src/components/entries/ListFrame.astro +126 -0
  36. package/src/components/entries/ListSearch.astro +24 -0
  37. package/src/components/entries/Share.astro +24 -0
  38. package/src/components/entries/course/classroom.astro +26 -0
  39. package/src/components/entries/course/lesson.astro +18 -0
  40. package/src/components/entries/course/section.ts +20 -0
  41. package/src/components/entries/course/syllabus.astro +15 -0
  42. package/src/components/entries/index.ts +77 -0
  43. package/src/components/entries/newsletter/issue.astro +41 -0
  44. package/src/components/entries/newsletter/list.astro +26 -0
  45. package/src/components/entries/podcast/episode.astro +42 -0
  46. package/src/components/entries/podcast/list.astro +36 -0
  47. package/src/components/entries/post/article.astro +31 -0
  48. package/src/components/entries/post/list.astro +85 -0
  49. package/src/components/entries/props.ts +61 -0
  50. package/src/components/entries/video/cards.astro +39 -0
  51. package/src/components/entries/video/grid.astro +15 -0
  52. package/src/components/entries/video/watch.astro +41 -0
  53. package/src/components/live/LivePage.astro +215 -0
  54. package/src/components/live/LocalTime.astro +29 -0
  55. package/src/components/sections/About/books.astro +188 -0
  56. package/src/components/sections/About/credentials.ts +90 -0
  57. package/src/components/sections/About/index.astro +57 -0
  58. package/src/components/sections/About/left.astro +54 -0
  59. package/src/components/sections/About/letter.astro +108 -0
  60. package/src/components/sections/About/portrait.astro +308 -0
  61. package/src/components/sections/Advocacy/compact.astro +14 -0
  62. package/src/components/sections/Advocacy/index.astro +14 -0
  63. package/src/components/sections/Band.astro +39 -0
  64. package/src/components/sections/Blog/feature.astro +176 -0
  65. package/src/components/sections/Blog/index.astro +37 -0
  66. package/src/components/sections/Blog/latest.ts +80 -0
  67. package/src/components/sections/Blog/list.astro +186 -0
  68. package/src/components/sections/Booking/index.astro +139 -0
  69. package/src/components/sections/Booking/list.astro +144 -0
  70. package/src/components/sections/Booking/types.ts +60 -0
  71. package/src/components/sections/Calendar/agenda.astro +14 -0
  72. package/src/components/sections/Calendar/index.astro +14 -0
  73. package/src/components/sections/CandidateRoster/ballot.astro +394 -0
  74. package/src/components/sections/CandidateRoster/candidates.ts +69 -0
  75. package/src/components/sections/CandidateRoster/compact.astro +115 -0
  76. package/src/components/sections/CandidateRoster/index.astro +57 -0
  77. package/src/components/sections/CaseStudies/beforeafter.astro +222 -0
  78. package/src/components/sections/CaseStudies/cases.ts +111 -0
  79. package/src/components/sections/CaseStudies/grid.astro +261 -0
  80. package/src/components/sections/CaseStudies/index.astro +333 -0
  81. package/src/components/sections/Classroom/CourseCard.astro +181 -0
  82. package/src/components/sections/Classroom/Courses.astro +88 -0
  83. package/src/components/sections/Classroom/classroom.ts +141 -0
  84. package/src/components/sections/Classroom/index.astro +20 -0
  85. package/src/components/sections/Classroom/list.astro +15 -0
  86. package/src/components/sections/Collection/compact.astro +7 -0
  87. package/src/components/sections/Collection/entries.ts +62 -0
  88. package/src/components/sections/Collection/feature.astro +180 -0
  89. package/src/components/sections/Collection/index.astro +46 -0
  90. package/src/components/sections/Collection/library.astro +271 -0
  91. package/src/components/sections/Collection/list.astro +7 -0
  92. package/src/components/sections/Collection/outline.astro +134 -0
  93. package/src/components/sections/Collection/shelves.astro +191 -0
  94. package/src/components/sections/Comparison/Unlisted.astro +6 -0
  95. package/src/components/sections/Comparison/cards.astro +171 -0
  96. package/src/components/sections/Comparison/index.astro +191 -0
  97. package/src/components/sections/Comparison/sides.ts +98 -0
  98. package/src/components/sections/Comparison/spectrum.astro +261 -0
  99. package/src/components/sections/ContentPost/banner.astro +152 -0
  100. package/src/components/sections/ContentPost/index.astro +35 -0
  101. package/src/components/sections/ContentPost/lesson.ts +119 -0
  102. package/src/components/sections/ContentPost/player.astro +254 -0
  103. package/src/components/sections/ContentPost/theater.astro +329 -0
  104. package/src/components/sections/Countdown/index.astro +53 -0
  105. package/src/components/sections/Course/Bar.astro +46 -0
  106. package/src/components/sections/Course/CourseHead.astro +123 -0
  107. package/src/components/sections/Course/Crumbs.astro +44 -0
  108. package/src/components/sections/Course/Icon.astro +29 -0
  109. package/src/components/sections/Course/Ring.astro +62 -0
  110. package/src/components/sections/Course/Syllabus.astro +146 -0
  111. package/src/components/sections/Course/course.ts +146 -0
  112. package/src/components/sections/Course/index.astro +143 -0
  113. package/src/components/sections/Course/outline.astro +39 -0
  114. package/src/components/sections/Cta/banner.astro +64 -0
  115. package/src/components/sections/Cta/card.astro +88 -0
  116. package/src/components/sections/Cta/index.astro +31 -0
  117. package/src/components/sections/Cta/photo.astro +114 -0
  118. package/src/components/sections/Cta/strip.astro +91 -0
  119. package/src/components/sections/Donate/index.astro +136 -0
  120. package/src/components/sections/Donate/story.astro +7 -0
  121. package/src/components/sections/Event/card.astro +14 -0
  122. package/src/components/sections/Event/index.astro +14 -0
  123. package/src/components/sections/EventsList/AgendaMonths.astro +105 -0
  124. package/src/components/sections/EventsList/CalendarLine.astro +23 -0
  125. package/src/components/sections/EventsList/EventRows.astro +196 -0
  126. package/src/components/sections/EventsList/LiveCounts.astro +75 -0
  127. package/src/components/sections/EventsList/TypeTabs.astro +53 -0
  128. package/src/components/sections/EventsList/agenda.astro +55 -0
  129. package/src/components/sections/EventsList/calendar.astro +392 -0
  130. package/src/components/sections/EventsList/cards.astro +186 -0
  131. package/src/components/sections/EventsList/cohorts.astro +205 -0
  132. package/src/components/sections/EventsList/compact.astro +163 -0
  133. package/src/components/sections/EventsList/events.ts +168 -0
  134. package/src/components/sections/EventsList/index.astro +46 -0
  135. package/src/components/sections/EventsList/map.astro +436 -0
  136. package/src/components/sections/EventsList/shifts.astro +355 -0
  137. package/src/components/sections/EventsList/week.astro +361 -0
  138. package/src/components/sections/Faq/Contact.astro +63 -0
  139. package/src/components/sections/Faq/Questions.astro +98 -0
  140. package/src/components/sections/Faq/cards.astro +74 -0
  141. package/src/components/sections/Faq/faq.ts +101 -0
  142. package/src/components/sections/Faq/index.astro +49 -0
  143. package/src/components/sections/Faq/topics.astro +178 -0
  144. package/src/components/sections/Financials/Foot.astro +38 -0
  145. package/src/components/sections/Financials/Head.astro +47 -0
  146. package/src/components/sections/Financials/donut.astro +197 -0
  147. package/src/components/sections/Financials/financials.ts +52 -0
  148. package/src/components/sections/Financials/index.astro +148 -0
  149. package/src/components/sections/Financials/table.astro +157 -0
  150. package/src/components/sections/FormBlock/index.astro +33 -0
  151. package/src/components/sections/FormBlock/wide.astro +7 -0
  152. package/src/components/sections/Hero/cover.astro +170 -0
  153. package/src/components/sections/Hero/donate.astro +209 -0
  154. package/src/components/sections/Hero/field.astro +390 -0
  155. package/src/components/sections/Hero/index.astro +52 -0
  156. package/src/components/sections/Hero/overlap.astro +151 -0
  157. package/src/components/sections/Hero/rotating.astro +30 -0
  158. package/src/components/sections/Hero/split.astro +96 -0
  159. package/src/components/sections/Hero/statement.astro +55 -0
  160. package/src/components/sections/Hero/video.astro +399 -0
  161. package/src/components/sections/Issues/checklist.astro +204 -0
  162. package/src/components/sections/Issues/drawer.astro +237 -0
  163. package/src/components/sections/Issues/index.astro +115 -0
  164. package/src/components/sections/Issues/issues.ts +37 -0
  165. package/src/components/sections/Issues/numbered.astro +79 -0
  166. package/src/components/sections/Issues/rows.astro +137 -0
  167. package/src/components/sections/Issues/steps.astro +81 -0
  168. package/src/components/sections/Issues/tabs.astro +322 -0
  169. package/src/components/sections/Leaderboard/index.astro +29 -0
  170. package/src/components/sections/Lesson/Door.astro +121 -0
  171. package/src/components/sections/Lesson/LessonBody.astro +416 -0
  172. package/src/components/sections/Lesson/Rail.astro +182 -0
  173. package/src/components/sections/Lesson/Tracker.astro +137 -0
  174. package/src/components/sections/Lesson/index.astro +27 -0
  175. package/src/components/sections/Lesson/lesson.ts +233 -0
  176. package/src/components/sections/Lesson/reading.astro +21 -0
  177. package/src/components/sections/Map/CoverageLine.astro +19 -0
  178. package/src/components/sections/Map/RegionMap.astro +109 -0
  179. package/src/components/sections/Map/bar.astro +160 -0
  180. package/src/components/sections/Map/index.astro +192 -0
  181. package/src/components/sections/Map/map.astro +275 -0
  182. package/src/components/sections/MediaKit/BioCard.astro +108 -0
  183. package/src/components/sections/MediaKit/Downloads.astro +88 -0
  184. package/src/components/sections/MediaKit/index.astro +183 -0
  185. package/src/components/sections/MediaKit/kit.ts +140 -0
  186. package/src/components/sections/MediaKit/press.astro +189 -0
  187. package/src/components/sections/MediaKit/speaker.astro +205 -0
  188. package/src/components/sections/Membership/Benefits.astro +42 -0
  189. package/src/components/sections/Membership/Check.astro +12 -0
  190. package/src/components/sections/Membership/Price.astro +61 -0
  191. package/src/components/sections/Membership/compare.astro +312 -0
  192. package/src/components/sections/Membership/index.astro +281 -0
  193. package/src/components/sections/Membership/offers.ts +169 -0
  194. package/src/components/sections/Membership/tiers.astro +217 -0
  195. package/src/components/sections/MovementMap/index.astro +50 -0
  196. package/src/components/sections/MovementTicker/index.astro +43 -0
  197. package/src/components/sections/Pathways/Doors.astro +147 -0
  198. package/src/components/sections/Pathways/Head.astro +37 -0
  199. package/src/components/sections/Pathways/index.astro +27 -0
  200. package/src/components/sections/Pathways/pathways.ts +100 -0
  201. package/src/components/sections/Pathways/quiz.astro +286 -0
  202. package/src/components/sections/Pathways/tabs.astro +271 -0
  203. package/src/components/sections/PdfEmbed/card.astro +99 -0
  204. package/src/components/sections/PdfEmbed/index.astro +26 -0
  205. package/src/components/sections/PdfEmbed/medium.astro +7 -0
  206. package/src/components/sections/PdfEmbed/tall.astro +7 -0
  207. package/src/components/sections/Petition/coverage.astro +14 -0
  208. package/src/components/sections/Petition/image.astro +14 -0
  209. package/src/components/sections/Petition/index.astro +14 -0
  210. package/src/components/sections/Petition/map.astro +14 -0
  211. package/src/components/sections/PlatformPlanks/anchors.ts +66 -0
  212. package/src/components/sections/PlatformPlanks/columns.astro +171 -0
  213. package/src/components/sections/PlatformPlanks/index.astro +56 -0
  214. package/src/components/sections/PlatformPlanks/longread.astro +250 -0
  215. package/src/components/sections/PollBlock/index.astro +30 -0
  216. package/src/components/sections/Portfolio/featured.astro +343 -0
  217. package/src/components/sections/Portfolio/index.astro +571 -0
  218. package/src/components/sections/Portfolio/strip.astro +173 -0
  219. package/src/components/sections/Portfolio/work.ts +100 -0
  220. package/src/components/sections/Progress/MatchClock.astro +166 -0
  221. package/src/components/sections/Progress/compact.astro +150 -0
  222. package/src/components/sections/Progress/index.astro +32 -0
  223. package/src/components/sections/Progress/match.astro +126 -0
  224. package/src/components/sections/Progress/ring.astro +179 -0
  225. package/src/components/sections/QuickDonate/DonateCard.astro +149 -0
  226. package/src/components/sections/QuickDonate/Picker.astro +95 -0
  227. package/src/components/sections/QuickDonate/band.astro +164 -0
  228. package/src/components/sections/QuickDonate/bar.astro +208 -0
  229. package/src/components/sections/QuickDonate/donate.ts +126 -0
  230. package/src/components/sections/QuickDonate/hero.astro +143 -0
  231. package/src/components/sections/QuickDonate/index.astro +73 -0
  232. package/src/components/sections/QuickDonate/jar.astro +225 -0
  233. package/src/components/sections/QuickDonate/ladder.astro +248 -0
  234. package/src/components/sections/QuoteStrip/carousel.astro +340 -0
  235. package/src/components/sections/QuoteStrip/index.astro +58 -0
  236. package/src/components/sections/QuoteStrip/logos.astro +226 -0
  237. package/src/components/sections/QuoteStrip/quotes.ts +61 -0
  238. package/src/components/sections/QuoteStrip/single.astro +92 -0
  239. package/src/components/sections/QuoteStrip/ticker.astro +319 -0
  240. package/src/components/sections/QuoteStrip/wall.astro +113 -0
  241. package/src/components/sections/Resources/band.astro +93 -0
  242. package/src/components/sections/Resources/featured.astro +239 -0
  243. package/src/components/sections/Resources/index.astro +225 -0
  244. package/src/components/sections/Resources/resources.ts +92 -0
  245. package/src/components/sections/SampleBallot/Position.astro +39 -0
  246. package/src/components/sections/SampleBallot/ballot.ts +92 -0
  247. package/src/components/sections/SampleBallot/cards.astro +299 -0
  248. package/src/components/sections/SampleBallot/index.astro +326 -0
  249. package/src/components/sections/SampleBallot/measures.astro +172 -0
  250. package/src/components/sections/Scorecard/grades.astro +141 -0
  251. package/src/components/sections/Scorecard/index.astro +294 -0
  252. package/src/components/sections/Scorecard/promise.astro +167 -0
  253. package/src/components/sections/Scorecard/votes.ts +83 -0
  254. package/src/components/sections/SectionHead.astro +31 -0
  255. package/src/components/sections/Services/Button.astro +24 -0
  256. package/src/components/sections/Services/Check.astro +12 -0
  257. package/src/components/sections/Services/Includes.astro +42 -0
  258. package/src/components/sections/Services/compare.astro +328 -0
  259. package/src/components/sections/Services/index.astro +187 -0
  260. package/src/components/sections/Services/list.astro +181 -0
  261. package/src/components/sections/Services/services.ts +80 -0
  262. package/src/components/sections/ShareKit/Actions.astro +71 -0
  263. package/src/components/sections/ShareKit/Buttons.astro +62 -0
  264. package/src/components/sections/ShareKit/compact.astro +123 -0
  265. package/src/components/sections/ShareKit/index.astro +160 -0
  266. package/src/components/sections/ShareKit/share.ts +60 -0
  267. package/src/components/sections/ShareKit/strip.astro +173 -0
  268. package/src/components/sections/SignupCapture/band.astro +7 -0
  269. package/src/components/sections/SignupCapture/index.astro +103 -0
  270. package/src/components/sections/SignupCapture/inline.astro +7 -0
  271. package/src/components/sections/SocialFeed/index.astro +34 -0
  272. package/src/components/sections/StatCards/feature.astro +143 -0
  273. package/src/components/sections/StatCards/index.astro +51 -0
  274. package/src/components/sections/StatCards/ribbon.astro +113 -0
  275. package/src/components/sections/StatCards/wall.astro +177 -0
  276. package/src/components/sections/Store/featured.astro +14 -0
  277. package/src/components/sections/Store/index.astro +14 -0
  278. package/src/components/sections/Stories/Status.astro +42 -0
  279. package/src/components/sections/Stories/StoryCards.astro +171 -0
  280. package/src/components/sections/Stories/cards.astro +42 -0
  281. package/src/components/sections/Stories/index.astro +238 -0
  282. package/src/components/sections/Stories/stories.ts +97 -0
  283. package/src/components/sections/Stories/timeline.astro +135 -0
  284. package/src/components/sections/TeamGrid/board.astro +280 -0
  285. package/src/components/sections/TeamGrid/index.astro +71 -0
  286. package/src/components/sections/TeamGrid/list.astro +306 -0
  287. package/src/components/sections/TeamGrid/people.ts +178 -0
  288. package/src/components/sections/VideoEmbed/index.astro +52 -0
  289. package/src/components/sections/VideoEmbed/landscape.astro +7 -0
  290. package/src/components/sections/VideoEmbed/portrait.astro +7 -0
  291. package/src/components/sections/VideoEmbed/square.astro +7 -0
  292. package/src/components/sections/VoterTools/DaysLeft.astro +33 -0
  293. package/src/components/sections/VoterTools/dates.astro +149 -0
  294. package/src/components/sections/VoterTools/index.astro +228 -0
  295. package/src/components/sections/VoterTools/polling.astro +141 -0
  296. package/src/components/sections/VoterTools/voter-tools.ts +70 -0
  297. package/src/components/sections/index.ts +370 -0
  298. package/src/components/sections/modules/Headed.astro +39 -0
  299. package/src/components/sections/modules/ModuleFrame.astro +179 -0
  300. package/src/components/volunteer/ShiftLive.astro +90 -0
  301. package/src/components/volunteer/detail.astro +247 -0
  302. package/src/components/volunteer/list.astro +298 -0
  303. package/src/components/volunteer/props.ts +21 -0
  304. package/src/env.d.ts +22 -0
  305. package/src/index.d.ts +10 -0
  306. package/src/index.js +64 -0
  307. package/src/layouts/Site.astro +371 -0
  308. package/src/lib/academy.ts +146 -0
  309. package/src/lib/brand.ts +534 -0
  310. package/src/lib/chrome.ts +119 -0
  311. package/src/lib/donate-frame.ts +64 -0
  312. package/src/lib/entries.ts +190 -0
  313. package/src/lib/env.ts +34 -0
  314. package/src/lib/event-map-draw.ts +91 -0
  315. package/src/lib/events.ts +476 -0
  316. package/src/lib/fonts.ts +116 -0
  317. package/src/lib/footer.ts +24 -0
  318. package/src/lib/format.ts +160 -0
  319. package/src/lib/geo.ts +131 -0
  320. package/src/lib/live.ts +54 -0
  321. package/src/lib/menu.ts +48 -0
  322. package/src/lib/petition-text.ts +29 -0
  323. package/src/lib/reading.ts +17 -0
  324. package/src/lib/regions.ts +215 -0
  325. package/src/lib/section.ts +94 -0
  326. package/src/lib/shifts.ts +186 -0
  327. package/src/lib/stream-time.ts +20 -0
  328. package/src/lib/stream.ts +141 -0
  329. package/src/lib/visitor.ts +54 -0
  330. package/src/routes/catch-all.astro +286 -0
  331. package/src/routes/form.astro +30 -0
  332. package/src/routes/live.astro +49 -0
  333. package/src/routes/not-found.astro +18 -0
  334. package/src/routes/preview.astro +60 -0
  335. package/src/routes/setup.astro +62 -0
  336. package/src/routes/volunteer-shift.astro +61 -0
  337. package/src/routes/volunteer.astro +37 -0
  338. package/src/styles/entries.css +784 -0
  339. package/src/styles/site.css +1839 -0
  340. package/src/template.ts +182 -0
@@ -0,0 +1,209 @@
1
+ ---
2
+ // Hero, 'donate' layout (REPORT §3 Hero, "Donate-hero", the amount grid
3
+ // built into the hero as WinRed's pages and bernie.org do): the kicker, the
4
+ // headline (its last word in the accent, as the cover sets it), the line
5
+ // under it and the Hero's second link as a quiet button at the left; at the
6
+ // right the donate card QuickDonate draws (QuickDonate/DonateCard.astro: the
7
+ // amounts, the monthly switch when the Hero offers it, the one button, the
8
+ // note). The Hero's first link is the donate link, so it is the card's button
9
+ // and is not drawn again. Every amount is a link to the organization's donate
10
+ // page in BackGold; nothing is collected here and no figure is raised or
11
+ // counted. With a photo, the photo fills the band behind both and the words
12
+ // sit on the cover's scrim in the photo band's inks (deep under the words, so
13
+ // they read on any photo); on a phone the photo shows above the words and the
14
+ // card follows them. The photo's alt text is `copy.imageAlt`, and its caption
15
+ // (`copy.caption`) a chip at the band's lower left, at its upper left on a
16
+ // phone where the photo shows. Without a photo the words and the card sit on
17
+ // the band, with no caption.
18
+ // Without a donate link there is nothing to give through: it draws the cover.
19
+ // The page-opening Hero's headline is the page's <h1> (`level={1}`); any
20
+ // other Hero's is an <h2>. A Hero with its signup form on carries an `embed`:
21
+ // BackGold's own form, framed under the words.
22
+ import type { ComponentProps } from 'astro/types'
23
+ import { Embed } from '@backgold/astro/components'
24
+ import Band from '../Band.astro'
25
+ import DonateCard from '../QuickDonate/DonateCard.astro'
26
+ import { quickDonate } from '../QuickDonate/donate'
27
+ import Cover from './cover.astro'
28
+ import type Default from './index.astro'
29
+ import { heroPhoto, links } from '../../../lib/section'
30
+ import { text } from '../../../lib/format'
31
+
32
+ type Props = ComponentProps<typeof Default>
33
+
34
+ const { section, level = 2 } = Astro.props
35
+ const qd = quickDonate(section)
36
+ const Heading = level === 1 ? 'h1' : 'h2'
37
+ const kicker = text(section.copy.kicker)
38
+ const headline = text(section.copy.headline)?.trim() ?? null
39
+ const subheadline = text(section.copy.subheadline)
40
+ const caption = text(section.copy.caption)
41
+ const picture = heroPhoto(section, 'imageUrl', 'photoUrl')
42
+ const [, second] = links(section)
43
+ // "More freedom. Fewer " and "excuses.": the last word apart, for the accent.
44
+ const split = headline ? /^(.*\s)(\S+)$/su.exec(headline) : null
45
+ const [lead, last] = split ? [split[1]!, split[2]!] : [headline ?? '', null]
46
+ ---
47
+ {qd ? (
48
+ <Band section={section} class:list={['hero-donate', picture && 'hero-donate-photo']}>
49
+ {picture && (
50
+ <>
51
+ <img
52
+ class="donate-image"
53
+ src={picture.url}
54
+ alt={picture.alt}
55
+ loading={level === 1 ? 'eager' : 'lazy'}
56
+ fetchpriority={level === 1 ? 'high' : undefined}
57
+ decoding="async"
58
+ />
59
+ <div class="donate-scrim" aria-hidden="true"></div>
60
+ {caption && <p class="photo-caption donate-caption">{caption}</p>}
61
+ </>
62
+ )}
63
+ <div class:list={['donate-grid', picture && 'donate-grid-photo']}>
64
+ <div class:list={['donate-words', picture && 'on-photo']}>
65
+ {kicker && <p class="kicker">{kicker}</p>}
66
+ {headline && <Heading class="donate-headline">{lead}{last && <em>{last}</em>}</Heading>}
67
+ {subheadline && <p class="donate-lede">{subheadline}</p>}
68
+ {second && (
69
+ <p class="actions">
70
+ <a class="button button-quiet" href={second.href} rel={second.rel}>{second.label}</a>
71
+ </p>
72
+ )}
73
+ {section.embed && <Embed embed={section.embed} title="Sign up" />}
74
+ </div>
75
+ <DonateCard qd={qd} />
76
+ </div>
77
+ </Band>
78
+ ) : (
79
+ <Cover {...Astro.props} />
80
+ )}
81
+
82
+ <style>
83
+ /* With a photo, the band is its frame, on the photo band's ground. */
84
+ :global(.bg-section.hero-donate-photo) {
85
+ position: relative;
86
+ isolation: isolate;
87
+ overflow: hidden;
88
+ background: var(--band-photo);
89
+ }
90
+ /* A frame is not the band's ground: the band after it keeps its own top padding. */
91
+ :global(.bg-section.bg-bleed-full.hero-donate-photo + .bg-section.bg-bleed-full) {
92
+ padding-top: var(--space);
93
+ }
94
+
95
+ .donate-image {
96
+ position: absolute;
97
+ inset: 0;
98
+ z-index: -2;
99
+ width: 100%;
100
+ height: 100%;
101
+ max-width: none;
102
+ object-fit: cover;
103
+ }
104
+ /* The cover's scrim on a phone: light at the top where the photo shows, deep from where the words start (the grid's top padding) down. */
105
+ .donate-scrim {
106
+ position: absolute;
107
+ inset: 0;
108
+ z-index: -1;
109
+ background: linear-gradient(
110
+ 180deg,
111
+ color-mix(in srgb, var(--band-photo) 10%, transparent) 0%,
112
+ color-mix(in srgb, var(--band-photo) 40%, transparent) 5rem,
113
+ color-mix(in srgb, var(--band-photo) 85%, transparent) 11rem,
114
+ color-mix(in srgb, var(--band-photo) 92%, transparent) 100%
115
+ );
116
+ }
117
+
118
+ /* On a phone the photo shows at the top of the band, so its caption sits there. */
119
+ .donate-caption {
120
+ top: 0.625rem;
121
+ bottom: auto;
122
+ }
123
+ .donate-grid {
124
+ display: grid;
125
+ gap: 2rem;
126
+ }
127
+ .donate-grid-photo {
128
+ padding-top: clamp(9rem, 32vw, 14rem);
129
+ }
130
+ .donate-words {
131
+ min-width: 0;
132
+ }
133
+ .donate-words .kicker {
134
+ margin-bottom: 0.875rem;
135
+ }
136
+ .donate-headline {
137
+ font-size: clamp(2.5rem, 1.5rem + 3.6vw, 4.5rem);
138
+ font-weight: 800;
139
+ line-height: 0.98;
140
+ letter-spacing: -0.03em;
141
+ max-width: 11em;
142
+ margin: 0;
143
+ }
144
+ .donate-headline em {
145
+ font-style: italic;
146
+ font-weight: 500;
147
+ color: var(--accent);
148
+ }
149
+ .donate-lede {
150
+ font-size: var(--text-lg);
151
+ color: var(--muted);
152
+ max-width: 32em;
153
+ margin: 1.25rem 0 0;
154
+ }
155
+ .on-photo .donate-lede {
156
+ color: color-mix(in srgb, var(--ink) 92%, transparent);
157
+ }
158
+ .donate-words .actions {
159
+ margin-top: 1.75rem;
160
+ }
161
+ .donate-words > :global(.bg-embed) {
162
+ margin-top: 1.5rem;
163
+ }
164
+ .donate-grid > :global(.qd-card) {
165
+ width: 100%;
166
+ max-width: 30rem;
167
+ }
168
+
169
+ @media (min-width: 56rem) {
170
+ .donate-grid {
171
+ grid-template-columns: minmax(0, 1fr) minmax(0, 26rem);
172
+ gap: clamp(2.5rem, 4.5vw, 4.5rem);
173
+ align-items: center;
174
+ }
175
+ .donate-caption {
176
+ top: auto;
177
+ bottom: 0.625rem;
178
+ }
179
+ .donate-grid-photo {
180
+ align-items: end;
181
+ min-height: 30rem;
182
+ padding-top: 4rem;
183
+ }
184
+ /* On a wide band the words sit at the left: deep there, the photo clearer towards the card. */
185
+ .donate-scrim {
186
+ background:
187
+ linear-gradient(
188
+ 90deg,
189
+ color-mix(in srgb, var(--band-photo) 88%, transparent) 0%,
190
+ color-mix(in srgb, var(--band-photo) 70%, transparent) 45%,
191
+ color-mix(in srgb, var(--band-photo) 20%, transparent) 80%
192
+ ),
193
+ linear-gradient(180deg, transparent 45%, color-mix(in srgb, var(--band-photo) 45%, transparent) 100%);
194
+ }
195
+ }
196
+ @media (prefers-reduced-motion: no-preference) {
197
+ .donate-headline,
198
+ .donate-lede {
199
+ animation: donate-rise 0.4s ease-out both;
200
+ }
201
+ }
202
+ /* A1's motion note, as the cover has it: the headline and lede rise 12px and fade in once on load. */
203
+ @keyframes donate-rise {
204
+ from {
205
+ opacity: 0;
206
+ transform: translateY(0.75rem);
207
+ }
208
+ }
209
+ </style>
@@ -0,0 +1,390 @@
1
+ ---
2
+ // Hero, 'field' layout ("Kindling"): the words centered over a field of dim,
3
+ // cool motes drawn on a canvas, through which fire moves the way an idea
4
+ // does: one mote catches, a pale wisp blooms, and it leaps to its nearest
5
+ // neighbours, which glow warm afterwards instead of burning out. The pointer
6
+ // kindles where it passes; left alone, the field kindles itself. The colours
7
+ // are the band's: the motes rest in a cool tint of the band's muted ink and
8
+ // warm to its accent, the wisps are its accent paled; so the field reads on
9
+ // whatever the organization's theme gives the band (it is drawn for a dark
10
+ // band, the contrast or brand band of a dark theme). It respects
11
+ // prefers-reduced-motion (one still frame, a few motes lit) and pauses when
12
+ // scrolled off-screen or the tab is hidden; with no JavaScript the words
13
+ // stand on the band alone.
14
+ //
15
+ // With something in its `aside` slot (a template's portrait), the field is a
16
+ // split: the words at the left, left-aligned, and the aside at the right; on
17
+ // a phone the aside sits under the words at 60% of the width. How bright the
18
+ // field burns is the band's `--field-glow` (1 when unset; a template's
19
+ // stylesheet raises it): the motes' light at rest and lit, the sparks' and
20
+ // wisps' light, how high a wisp rises and how long a spark's trail lingers
21
+ // after it lands. How far fire leaps does not change.
22
+ //
23
+ // The words are the cover layout's: the kicker, the headline with its accent
24
+ // in italic (the part after a colon when the headline has one, else the last
25
+ // word), the line under it, the buttons (the first the main call, the rest
26
+ // outlines), under them whatever a template's own Hero · field passes in the
27
+ // default slot (the academy's proof line, its counts from the Content API),
28
+ // and `copy.note` as a small line ("Move through the field. Something
29
+ // catches."). The page-opening Hero's headline is the page's
30
+ // <h1> (`level={1}`); any other Hero's is an <h2>. A Hero with its signup
31
+ // form on carries an `embed`: BackGold's own form, framed under the buttons.
32
+ import type { ComponentProps } from 'astro/types'
33
+ import { Embed } from '@backgold/astro/components'
34
+ import Band from '../Band.astro'
35
+ import type Default from './index.astro'
36
+ import { links } from '../../../lib/section'
37
+ import { text } from '../../../lib/format'
38
+
39
+ type Props = ComponentProps<typeof Default>
40
+
41
+ const { section, level = 2 } = Astro.props
42
+ const Heading = level === 1 ? 'h1' : 'h2'
43
+ const kicker = text(section.copy.kicker)
44
+ const headline = text(section.copy.headline)?.trim() ?? null
45
+ const subheadline = text(section.copy.subheadline)
46
+ const note = text(section.copy.note)
47
+ const buttons = links(section)
48
+ // "Liberty spreads the way fire does: one mind at a time." → the clause after the colon in the accent; else the last word.
49
+ const colon = headline ? /^(.*?:\s+)(\S.*)$/su.exec(headline) : null
50
+ const split = colon ?? (headline ? /^(.*\s)(\S+)$/su.exec(headline) : null)
51
+ const [lead, last] = split ? [split[1]!, split[2]!] : [headline ?? '', null]
52
+ const aside = Astro.slots.has('aside')
53
+ ---
54
+ <Band section={section} class={aside ? 'hero-field hero-field-split' : 'hero-field'}>
55
+ <canvas class="field-canvas" aria-hidden="true"></canvas>
56
+ <div class="field-words">
57
+ {kicker && <p class="kicker">{kicker}</p>}
58
+ {headline && <Heading class="field-headline">{lead}{last && <em>{last}</em>}</Heading>}
59
+ {subheadline && <p class="field-lede">{subheadline}</p>}
60
+ {buttons.length > 0 && (
61
+ <p class="actions">
62
+ {buttons.map((link, i) => <a class:list={['button', i > 0 && 'button-quiet']} href={link.href} rel={link.rel}>{link.label}</a>)}
63
+ </p>
64
+ )}
65
+ <slot />
66
+ {note && <p class="field-note">{note}</p>}
67
+ {section.embed && <Embed embed={section.embed} title="Sign up" />}
68
+ </div>
69
+ {aside && <div class="field-aside"><slot name="aside" /></div>}
70
+ <script is:inline>
71
+ ;(function (root) {
72
+ var canvas = root && root.querySelector('canvas.field-canvas')
73
+ if (!canvas || !canvas.getContext) return
74
+ var ctx = canvas.getContext('2d', { alpha: true })
75
+ var reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches
76
+ var DPR = Math.min(window.devicePixelRatio || 1, 1.5)
77
+ // The band's colours: the motes rest cool (the muted ink toward blue) and warm to the accent; the wisps are the accent paled.
78
+ var style = getComputedStyle(root)
79
+ var parse = function (value, fallback) {
80
+ var probe = document.createElement('span')
81
+ probe.style.color = value
82
+ root.appendChild(probe)
83
+ var m = /rgba?\((\d+),\s*(\d+),\s*(\d+)/.exec(getComputedStyle(probe).color)
84
+ root.removeChild(probe)
85
+ return m ? [+m[1], +m[2], +m[3]] : fallback
86
+ }
87
+ var ACCENT = parse(style.getPropertyValue('--accent') || '', [255, 179, 92])
88
+ var MUTED = parse(style.getPropertyValue('--muted') || '', [140, 140, 160])
89
+ var mix = function (a, b, t) {
90
+ return [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t, a[2] + (b[2] - a[2]) * t]
91
+ }
92
+ // How bright the field burns (1 unless the band's --field-glow says otherwise), and what follows from it.
93
+ var GLOW = Math.max(0.25, Math.min(4, parseFloat(style.getPropertyValue('--field-glow')) || 1))
94
+ var HOT = Math.min(1.6, GLOW)
95
+ var RISE = 1 + (GLOW - 1) * 0.5
96
+ var TRAIL = Math.max(0, (GLOW - 1) * 300)
97
+ var COOL = mix(MUTED, [122, 140, 255], 0.55)
98
+ var WARM = mix(ACCENT, [255, 190, 110], 0.35)
99
+ var PALE = mix(ACCENT, [255, 255, 255], 0.72)
100
+ var rgba = function (c, a) {
101
+ return 'rgba(' + (c[0] | 0) + ',' + (c[1] | 0) + ',' + (c[2] | 0) + ',' + a + ')'
102
+ }
103
+ var W = 0, H = 0, motes = [], sparks = [], wisps = []
104
+ var pointer = { x: -1e4, y: -1e4, t: 0 }
105
+ var running = false, lastAuto = 0, lastPointer = 0
106
+ function resize() {
107
+ var r = root.getBoundingClientRect()
108
+ W = Math.max(1, Math.floor(r.width))
109
+ H = Math.max(1, Math.floor(r.height))
110
+ canvas.width = Math.floor(W * DPR)
111
+ canvas.height = Math.floor(H * DPR)
112
+ canvas.style.width = W + 'px'
113
+ canvas.style.height = H + 'px'
114
+ ctx.setTransform(DPR, 0, 0, DPR, 0, 0)
115
+ seed()
116
+ }
117
+ // A resize seeds a new field: the sparks and wisps of the old one name motes it no longer has, so they go with it.
118
+ function seed() {
119
+ var n = Math.round(Math.min(220, Math.max(70, (W * H) / 4200)))
120
+ motes = []
121
+ sparks = []
122
+ wisps = []
123
+ for (var i = 0; i < n; i++) {
124
+ motes.push({ x: Math.random() * W, y: Math.random() * H, r: 1.1 + Math.random() * 1.9, base: 0.2 + Math.random() * 0.3, heat: 0, warm: 0, ph: Math.random() * Math.PI * 2, sp: 0.15 + Math.random() * 0.35, lastLit: -1e9 })
125
+ }
126
+ }
127
+ function kindle(i, now, strength) {
128
+ var m = motes[i]
129
+ if (!m || now - m.lastLit < 1400) return
130
+ m.heat = Math.max(m.heat, strength || 1)
131
+ m.lastLit = now
132
+ wisps.push({ x: m.x, y: m.y, t0: now, life: (1400 + Math.random() * 900) * RISE, size: 16 + Math.random() * 18 })
133
+ var R = 120, leaps = 0
134
+ for (var j = 0; j < motes.length && leaps < 4; j++) {
135
+ if (j === i) continue
136
+ var n = motes[j], dx = n.x - m.x, dy = n.y - m.y, d2 = dx * dx + dy * dy
137
+ if (d2 < R * R && now - n.lastLit > 1400 && Math.random() < 0.55) {
138
+ sparks.push({ from: i, to: j, t0: now, dur: 260 + Math.sqrt(d2) * 3 })
139
+ leaps++
140
+ }
141
+ }
142
+ }
143
+ function nearest(x, y) {
144
+ var best = -1, bd = 1e12
145
+ for (var i = 0; i < motes.length; i++) {
146
+ var dx = motes[i].x - x, dy = motes[i].y - y, d = dx * dx + dy * dy
147
+ if (d < bd) { bd = d; best = i }
148
+ }
149
+ return bd < 70 * 70 ? best : -1
150
+ }
151
+ function drawWisp(w, now) {
152
+ var t = (now - w.t0) / w.life
153
+ if (t >= 1) return false
154
+ var a = t < 0.2 ? t / 0.2 : 1 - (t - 0.2) / 0.8
155
+ var s = w.size * (0.6 + 0.6 * Math.sin(t * Math.PI))
156
+ var x = w.x + Math.sin(now / 300 + w.t0) * 2, y = w.y - t * 26 * RISE
157
+ var g = ctx.createRadialGradient(x, y + s * 0.15, 0, x, y, s)
158
+ g.addColorStop(0, rgba(PALE, Math.min(1, 0.75 * a * HOT)))
159
+ g.addColorStop(0.35, rgba(WARM, Math.min(1, 0.45 * a * HOT)))
160
+ g.addColorStop(0.7, rgba(COOL, 0.12 * a))
161
+ g.addColorStop(1, 'rgba(0,0,0,0)')
162
+ ctx.fillStyle = g
163
+ ctx.beginPath()
164
+ ctx.ellipse(x, y, s * 0.55, s, 0, 0, Math.PI * 2)
165
+ ctx.fill()
166
+ return true
167
+ }
168
+ // One frame of the field. A draw that throws costs that frame only: the next is asked for whatever happens, while the field runs.
169
+ function frame(now) {
170
+ if (!running) return
171
+ try {
172
+ draw(now)
173
+ } finally {
174
+ requestAnimationFrame(frame)
175
+ }
176
+ }
177
+ function draw(now) {
178
+ ctx.clearRect(0, 0, W, H)
179
+ if (now - pointer.t < 1200 && now - lastPointer > 140) {
180
+ var p = nearest(pointer.x, pointer.y)
181
+ if (p >= 0) { kindle(p, now, 1); lastPointer = now }
182
+ }
183
+ if (now - pointer.t > 2500 && now - lastAuto > 900 + Math.random() * 900) {
184
+ kindle(Math.floor(Math.random() * motes.length), now, 0.9)
185
+ lastAuto = now
186
+ }
187
+ ctx.lineWidth = 1 + (HOT - 1) * 0.6
188
+ for (var k = sparks.length - 1; k >= 0; k--) {
189
+ var s = sparks[k], a = motes[s.from], b = motes[s.to], t = (now - s.t0) / s.dur
190
+ if (!a || !b) { sparks.splice(k, 1); continue }
191
+ // A spark that has landed lights its mote once, and its trail lingers, fading, for TRAIL ms.
192
+ if (t >= 1 && !s.landed) { s.landed = now; kindle(s.to, now, 0.85) }
193
+ var fade = s.landed ? (TRAIL ? 1 - (now - s.landed) / TRAIL : 0) : 1
194
+ if (fade <= 0) { sparks.splice(k, 1); continue }
195
+ var u = Math.min(1, t)
196
+ var x = a.x + (b.x - a.x) * u, y = a.y + (b.y - a.y) * u - Math.sin(u * Math.PI) * 6
197
+ var lg = ctx.createLinearGradient(a.x, a.y, x, y)
198
+ lg.addColorStop(0, rgba(WARM, 0))
199
+ lg.addColorStop(1, rgba(PALE, Math.min(1, 0.55 * HOT) * fade))
200
+ ctx.strokeStyle = lg
201
+ ctx.beginPath(); ctx.moveTo(a.x, a.y); ctx.lineTo(x, y); ctx.stroke()
202
+ ctx.fillStyle = rgba(PALE, 0.9 * fade)
203
+ ctx.beginPath(); ctx.arc(x, y, 1.4 * HOT, 0, Math.PI * 2); ctx.fill()
204
+ }
205
+ for (var i = 0; i < motes.length; i++) {
206
+ var m = motes[i]
207
+ m.x += Math.sin(now / 4000 + m.ph) * 0.06 * m.sp
208
+ m.y -= 0.02 * m.sp
209
+ if (m.y < -4) { m.y = H + 4; m.x = Math.random() * W }
210
+ if (m.heat > 0) { m.heat *= 0.975; m.warm = Math.min(1, m.warm + 0.02); if (m.heat < 0.01) m.heat = 0 }
211
+ else if (m.warm > 0) m.warm *= 0.9992
212
+ var tw = 0.5 + 0.5 * Math.sin(now / 900 + m.ph)
213
+ var lit = Math.max(m.heat, m.warm * 0.6)
214
+ var col = mix(COOL, WARM, lit)
215
+ var alpha = m.base * GLOW * (0.7 + 0.3 * tw) + lit * 0.7
216
+ var r = m.r + lit * 1.6
217
+ if (lit > 0.05) {
218
+ var rg = ctx.createRadialGradient(m.x, m.y, 0, m.x, m.y, r * 6)
219
+ rg.addColorStop(0, rgba(col, Math.min(1, 0.35 * lit * HOT)))
220
+ rg.addColorStop(1, 'rgba(0,0,0,0)')
221
+ ctx.fillStyle = rg
222
+ ctx.beginPath(); ctx.arc(m.x, m.y, r * 6, 0, Math.PI * 2); ctx.fill()
223
+ }
224
+ ctx.fillStyle = rgba(lit > 0.5 ? mix(col, PALE, (lit - 0.5) * 2) : col, Math.min(1, alpha))
225
+ ctx.beginPath(); ctx.arc(m.x, m.y, r, 0, Math.PI * 2); ctx.fill()
226
+ }
227
+ ctx.globalCompositeOperation = 'lighter'
228
+ try {
229
+ for (var q = wisps.length - 1; q >= 0; q--) if (!drawWisp(wisps[q], now)) wisps.splice(q, 1)
230
+ } finally {
231
+ ctx.globalCompositeOperation = 'source-over'
232
+ }
233
+ }
234
+ function still() {
235
+ ctx.clearRect(0, 0, W, H)
236
+ for (var i = 0; i < motes.length; i++) {
237
+ var m = motes[i], lit = Math.random() < 0.12 ? 0.8 : 0, col = mix(COOL, WARM, lit)
238
+ if (lit) {
239
+ var g = ctx.createRadialGradient(m.x, m.y, 0, m.x, m.y, 14)
240
+ g.addColorStop(0, rgba(col, 0.35)); g.addColorStop(1, 'rgba(0,0,0,0)')
241
+ ctx.fillStyle = g
242
+ ctx.beginPath(); ctx.arc(m.x, m.y, 14, 0, Math.PI * 2); ctx.fill()
243
+ }
244
+ ctx.fillStyle = rgba(col, Math.min(1, m.base * GLOW + lit * 0.6))
245
+ ctx.beginPath(); ctx.arc(m.x, m.y, m.r + lit, 0, Math.PI * 2); ctx.fill()
246
+ }
247
+ }
248
+ function start() { if (!running) { running = true; requestAnimationFrame(frame) } }
249
+ function stop() { running = false }
250
+ resize()
251
+ window.addEventListener('resize', function () { resize(); if (reduce) still() })
252
+ if (reduce) { still(); return }
253
+ root.addEventListener('pointermove', function (e) {
254
+ var r = canvas.getBoundingClientRect()
255
+ pointer = { x: e.clientX - r.left, y: e.clientY - r.top, t: performance.now() }
256
+ })
257
+ root.addEventListener('pointerdown', function (e) {
258
+ var r = canvas.getBoundingClientRect()
259
+ var i = nearest(e.clientX - r.left, e.clientY - r.top)
260
+ if (i >= 0) kindle(i, performance.now(), 1)
261
+ })
262
+ if ('IntersectionObserver' in window) {
263
+ new IntersectionObserver(function (entries) {
264
+ entries.forEach(function (en) { en.isIntersecting ? start() : stop() })
265
+ }).observe(canvas)
266
+ } else start()
267
+ document.addEventListener('visibilitychange', function () { document.hidden ? stop() : start() })
268
+ ;[500, 900, 1400].forEach(function (d) {
269
+ setTimeout(function () { kindle(Math.floor(Math.random() * motes.length), performance.now(), 1) }, d)
270
+ })
271
+ })(document.currentScript.closest('.bg-section'))
272
+ </script>
273
+ </Band>
274
+
275
+ <style>
276
+ /* The band itself: the field's frame. Band.astro renders it, so it is reached through its class. */
277
+ :global(.bg-section.hero-field) {
278
+ position: relative;
279
+ isolation: isolate;
280
+ overflow: hidden;
281
+ display: flex;
282
+ align-items: center;
283
+ min-height: 34rem;
284
+ --bg-section-padding: clamp(4rem, 2rem + 6vw, 7rem) var(--gutter);
285
+ }
286
+ :global(.bg-section.hero-field) > :global(.bg-section-inner) {
287
+ width: 100%;
288
+ }
289
+ .field-canvas {
290
+ position: absolute;
291
+ inset: 0;
292
+ z-index: -1;
293
+ width: 100%;
294
+ height: 100%;
295
+ pointer-events: none;
296
+ }
297
+ .field-words {
298
+ display: flex;
299
+ flex-direction: column;
300
+ align-items: center;
301
+ max-width: 46rem;
302
+ margin: 0 auto;
303
+ text-align: center;
304
+ }
305
+ .field-words .kicker {
306
+ margin-bottom: 1rem;
307
+ }
308
+ .field-headline {
309
+ font-size: clamp(2.6rem, 1.6rem + 4.2vw, 5rem);
310
+ font-weight: 500;
311
+ line-height: 1.04;
312
+ letter-spacing: -0.02em;
313
+ margin: 0;
314
+ text-wrap: balance;
315
+ }
316
+ .field-headline em {
317
+ font-style: italic;
318
+ font-weight: 500;
319
+ color: var(--accent);
320
+ }
321
+ .field-lede {
322
+ font-size: var(--text-lg);
323
+ color: var(--muted);
324
+ max-width: 34em;
325
+ margin: 1.375rem 0 0;
326
+ text-wrap: pretty;
327
+ }
328
+ .field-words .actions {
329
+ justify-content: center;
330
+ margin-top: 1.875rem;
331
+ }
332
+ .field-note {
333
+ margin: 1.75rem 0 0;
334
+ color: var(--muted);
335
+ font-size: var(--text-sm);
336
+ letter-spacing: 0.01em;
337
+ }
338
+ .field-words > :global(.bg-embed) {
339
+ margin-top: 1.5rem;
340
+ }
341
+ /* The split: the words at the left, left-aligned, the aside at the right (under the words at 60% on a phone). */
342
+ :global(.bg-section.hero-field-split) > :global(.bg-section-inner) {
343
+ display: grid;
344
+ gap: 2.5rem 4rem;
345
+ align-items: center;
346
+ }
347
+ :global(.hero-field-split) .field-words {
348
+ align-items: flex-start;
349
+ max-width: none;
350
+ margin: 0;
351
+ text-align: left;
352
+ }
353
+ :global(.hero-field-split) .field-words .actions {
354
+ justify-content: flex-start;
355
+ }
356
+ .field-aside {
357
+ position: relative;
358
+ justify-self: center;
359
+ width: 60%;
360
+ min-width: 0;
361
+ }
362
+ @media (min-width: 56rem) {
363
+ :global(.bg-section.hero-field-split) > :global(.bg-section-inner) {
364
+ grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
365
+ }
366
+ .field-aside {
367
+ width: 100%;
368
+ }
369
+ }
370
+ @media (min-width: 48rem) {
371
+ :global(.bg-section.hero-field) {
372
+ min-height: 40rem;
373
+ }
374
+ }
375
+ @media (prefers-reduced-motion: no-preference) {
376
+ .field-headline,
377
+ .field-lede {
378
+ animation: field-rise 0.5s ease-out both;
379
+ }
380
+ .field-lede {
381
+ animation-delay: 0.1s;
382
+ }
383
+ }
384
+ @keyframes field-rise {
385
+ from {
386
+ opacity: 0;
387
+ transform: translateY(0.75rem);
388
+ }
389
+ }
390
+ </style>
@@ -0,0 +1,52 @@
1
+ ---
2
+ // Hero: the headline, a line under it, one call to action and a picture.
3
+ // When the page opens with a Hero, its headline is the page's <h1> (the
4
+ // page's LeadingHero passes `level={1}`); any other Hero uses an <h2>.
5
+ // `variant` is the layout chosen in BackGold ('split' puts the picture beside
6
+ // the words; anything else stacks them). The picture's alt text is
7
+ // `copy.imageAlt`, and its caption (`copy.caption`) a chip at its lower left;
8
+ // with no picture there is no caption.
9
+ // A Hero with its signup form on carries an `embed`: BackGold's own form,
10
+ // framed below the words (never rebuild it here; consent stays with BackGold).
11
+ import type { Section } from '@backgold/content'
12
+ import { Embed } from '@backgold/astro/components'
13
+ import Band from '../Band.astro'
14
+ import { heroPhoto, links } from '../../../lib/section'
15
+ import { text } from '../../../lib/format'
16
+
17
+ interface Props {
18
+ section: Section
19
+ variant?: string
20
+ level?: 1 | 2
21
+ }
22
+
23
+ const { section, level = 2 } = Astro.props
24
+ const Heading = level === 1 ? 'h1' : 'h2'
25
+ const headline = text(section.copy.headline)
26
+ const subheadline = text(section.copy.subheadline)
27
+ const caption = text(section.copy.caption)
28
+ const picture = heroPhoto(section, 'imageUrl', 'photoUrl', 'videoPosterUrl')
29
+ const [cta] = links(section)
30
+ const split = section.variant === 'split' && picture !== null
31
+ ---
32
+ <Band section={section} class:list={['hero', split && 'hero-split']}>
33
+ <div class="hero-words">
34
+ {headline && <Heading class="hero-headline">{headline}</Heading>}
35
+ {subheadline && <p class="hero-lede">{subheadline}</p>}
36
+ {cta && <p class="actions"><a class="button" href={cta.href} rel={cta.rel}>{cta.label}</a></p>}
37
+ {section.embed && <Embed embed={section.embed} title="Sign up" />}
38
+ </div>
39
+ {picture && (
40
+ <div class="hero-photo">
41
+ <img
42
+ class="hero-image"
43
+ src={picture.url}
44
+ alt={picture.alt}
45
+ loading={level === 1 ? 'eager' : 'lazy'}
46
+ fetchpriority={level === 1 ? 'high' : undefined}
47
+ decoding="async"
48
+ />
49
+ {caption && <p class="photo-caption">{caption}</p>}
50
+ </div>
51
+ )}
52
+ </Band>