Skip to content

Commit 530db5f

Browse files
author
benquist
committed
news: design overhaul — sticky feature, disclosure, images for text-only cards, badge size fix, mobile strip scroll [2026-05-15]
- Remove min-height: 100% from .news-feature (inert but confusing; feature was already sized correctly by align-items:start) - Add position:sticky to .news-feature at min-width:993px — feature card stays in view while scrolling long card grids - Progressive disclosure: show first 6 cards per section; Show N more button beneath grid; resets cleanly after shuffle - Fix two text-only cards: WEF UNESCO + National Academies now have Wikimedia thumbnail images; onerror collapses grid column if load fails - Source badge: 0.67rem→0.72rem, padding 0px 4px→1px 5px (WCAG legibility) - Mobile (≤700px) news-latest__strip: flex horizontal scroll strip instead of 1-col stack; flex: 0 0 220px per item - JS: image onerror handler collapses card grid column gracefully; initDisclosure() runs after shuffle on button click
1 parent d1c237b commit 530db5f

2 files changed

Lines changed: 312 additions & 6 deletions

File tree

_pages/news.md

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ _styles: |
8383
</div>
8484
</article>
8585
<div class="news-theme__cards">
86-
<article class="news-card news-card--text-only"><div><div class="news-meta">September 2023</div><h3 class="news-title"><span class="news-source">World Economic Forum</span><a href="https://www.weforum.org/stories/2023/09/unesco-world-heritage-sites-biodiversity/" target="_blank" rel="noopener">UNESCO World Heritage Sites and Biodiversity</a></h3></div></article>
86+
<article class="news-card"><div><div class="news-meta">September 2023</div><h3 class="news-title"><span class="news-source">World Economic Forum</span><a href="https://www.weforum.org/stories/2023/09/unesco-world-heritage-sites-biodiversity/" target="_blank" rel="noopener">UNESCO World Heritage Sites and Biodiversity</a></h3></div><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/13/Fagus_sylvatica_forest.jpg/480px-Fagus_sylvatica_forest.jpg" alt="Ancient beech forest — UNESCO World Heritage forests harbour exceptional biodiversity and old-growth carbon stores" loading="lazy" onerror="this.closest('.news-card').style.gridTemplateColumns='1fr';this.style.display='none'"></article>
8787
<article class="news-card"><div><div class="news-meta">June 2023</div><h3 class="news-title"><span class="news-source">Inside Climate News</span><a href="https://insideclimatenews.org/news/01062023/nature-carbon-storage-solutions/" target="_blank" rel="noopener">New Research Shows Global Climate Benefits Of Protecting Nature, but It's Not a Silver Bullet</a></h3></div><img src="https://insideclimatenews.org/wp-content/uploads/2023/05/forest-getty-scaled.jpg" alt="Forest carbon storage" loading="lazy"></article>
8888
<article class="news-card"><div><div class="news-meta">2023</div><h3 class="news-title"><span class="news-source">NAU News</span><a href="https://news.nau.edu/goetz-forest-research/" target="_blank" rel="noopener">Why protecting forests means reduced emissions at global scale</a></h3></div><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/bc/Rainforest_Fatu_Hiva.jpg/960px-Rainforest_Fatu_Hiva.jpg" alt="Tropical rainforest, Fatu Hiva — dense forest canopy as global carbon sink" loading="lazy"></article>
8989
<article class="news-card"><div><div class="news-meta">August 2022</div><h3 class="news-title"><span class="news-source">Mongabay</span><a href="https://news.mongabay.com/2022/08/protecting-global-forests-with-a-limited-budget-new-study-shows-where-and-when-to-start/" target="_blank" rel="noopener">Protecting global forests with a limited budget? New study shows where and when to start</a></h3></div><img src="https://imgs.mongabay.com/wp-content/uploads/sites/20/2022/06/17045519/sabah_RAB.jpg" alt="Borneo forest conservation" loading="lazy"></article>
@@ -170,7 +170,7 @@ _styles: |
170170
</div>
171171
</article>
172172
<div class="news-theme__cards">
173-
<article class="news-card news-card--text-only"><div><div class="news-meta">2022</div><h3 class="news-title"><span class="news-source">National Academies of Sciences</span><a href="https://www.nationalacademies.org/projects/DELS-BEST-20-02" target="_blank" rel="noopener">Research at Multiple Scales: A Vision for Continental Scale Biology</a></h3></div></article>
173+
<article class="news-card"><div><div class="news-meta">2022</div><h3 class="news-title"><span class="news-source">National Academies of Sciences</span><a href="https://www.nationalacademies.org/projects/DELS-BEST-20-02" target="_blank" rel="noopener">Research at Multiple Scales: A Vision for Continental Scale Biology</a></h3></div><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4c/Aerial_view_of_the_Okavango_Delta.jpg/480px-Aerial_view_of_the_Okavango_Delta.jpg" alt="Aerial view of a continental ecosystem — research at multiple biological scales from organisms to landscapes" loading="lazy" onerror="this.closest('.news-card').style.gridTemplateColumns='1fr';this.style.display='none'"></article>
174174
<article class="news-card"><div><div class="news-meta">April 2024</div><h3 class="news-title"><span class="news-source">Phys.org</span><a href="https://phys.org/news/2024-04-biosphere-science-reconnect-scientific-cultures.html" target="_blank" rel="noopener">To accelerate biosphere science, researchers say reconnect three scientific cultures</a></h3></div><img src="https://scx2.b-cdn.net/gfx/news/hires/2024/to-accelerate-biospher.jpg" alt="Biosphere science" loading="lazy"></article>
175175
<article class="news-card"><div><div class="news-meta">July 2014</div><h3 class="news-title"><span class="news-source">Phys.org</span><a href="https://phys.org/news/2014-07-ecologists-efficient-theory.html" target="_blank" rel="noopener">Ecologists need &lsquo;efficient theory&rsquo; to make sense of all the data</a></h3></div><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/50/Terrestrial_Ecoregions_of_the_World.jpg/960px-Terrestrial_Ecoregions_of_the_World.jpg" alt="WWF Terrestrial Ecoregions of the World — global biodiversity data demanding coherent ecological theory" loading="lazy"></article>
176176
</div>
@@ -179,6 +179,42 @@ _styles: |
179179
</div>
180180

181181
<script>
182+
function initDisclosure() {
183+
// Remove any existing show-more buttons before re-initialising
184+
document.querySelectorAll('.news-show-more').forEach(function (b) { b.remove(); });
185+
186+
document.querySelectorAll('.news-theme__cards').forEach(function (grid) {
187+
var cards = Array.from(grid.querySelectorAll('.news-card'));
188+
var limit = 6;
189+
190+
// Reset all cards to visible first
191+
cards.forEach(function (c) { c.classList.remove('news-card--hidden'); });
192+
193+
if (cards.length <= limit) return;
194+
195+
// Hide cards beyond the limit
196+
cards.slice(limit).forEach(function (c) { c.classList.add('news-card--hidden'); });
197+
198+
var hiddenCount = cards.length - limit;
199+
var sectionEl = grid.closest('.news-theme');
200+
var sectionTitle = sectionEl && sectionEl.querySelector('h2')
201+
? sectionEl.querySelector('h2').textContent
202+
: 'this section';
203+
204+
var btn = document.createElement('button');
205+
btn.className = 'news-show-more';
206+
btn.textContent = 'Show ' + hiddenCount + ' more';
207+
btn.setAttribute('aria-label', 'Show ' + hiddenCount + ' more stories in ' + sectionTitle);
208+
btn.addEventListener('click', function () {
209+
cards.forEach(function (c) { c.classList.remove('news-card--hidden'); });
210+
btn.remove();
211+
});
212+
// Insert after the grid container (outside both columns)
213+
var gridContainer = grid.closest('.news-theme__grid');
214+
if (gridContainer) gridContainer.after(btn);
215+
});
216+
}
217+
182218
function shuffleNewsSections() {
183219
var container = document.querySelector('.news-page');
184220
if (!container) return;
@@ -196,9 +232,21 @@ function shuffleNewsSections() {
196232
sections.forEach(function (section) {
197233
container.appendChild(section);
198234
});
235+
236+
// Re-run disclosure so buttons sit in the correct DOM position after reorder
237+
initDisclosure();
199238
}
200239

201240
document.addEventListener('DOMContentLoaded', function () {
202241
shuffleNewsSections();
242+
243+
// Graceful fallback for any external image that fails to load
244+
document.querySelectorAll('.news-page img').forEach(function (img) {
245+
img.addEventListener('error', function () {
246+
var card = this.closest('.news-card');
247+
if (card) card.style.gridTemplateColumns = '1fr';
248+
this.style.display = 'none';
249+
});
250+
});
203251
});
204252
</script>

_sass/_lab-redesign.scss

Lines changed: 262 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,6 @@ figure {
14551455
.news-feature {
14561456
display: flex;
14571457
flex-direction: column;
1458-
min-height: 100%;
14591458
overflow: hidden;
14601459
background: color-mix(in srgb, var(--global-theme-color) 12%, var(--global-card-bg-color) 88%);
14611460

@@ -1473,6 +1472,13 @@ figure {
14731472
}
14741473
}
14751474

1475+
@media (min-width: 993px) {
1476+
.news-feature {
1477+
position: sticky;
1478+
top: calc(var(--navbar-height, 64px) + 1rem);
1479+
}
1480+
}
1481+
14761482
.news-feature__body {
14771483
padding: 1rem 1rem 0.85rem;
14781484
}
@@ -1516,6 +1522,33 @@ figure {
15161522
grid-template-columns: 1fr;
15171523
}
15181524

1525+
.news-card--hidden {
1526+
display: none;
1527+
}
1528+
1529+
.news-show-more {
1530+
display: inline-flex;
1531+
align-items: center;
1532+
margin: 0.6rem 0 0;
1533+
padding: 4px 12px;
1534+
font-size: 0.76rem;
1535+
font-family: "Source Sans 3", sans-serif;
1536+
font-weight: 600;
1537+
text-transform: uppercase;
1538+
letter-spacing: 0.04em;
1539+
color: var(--global-theme-color);
1540+
background: none;
1541+
border: 1px solid color-mix(in srgb, var(--global-theme-color) 45%, transparent);
1542+
border-radius: 3px;
1543+
cursor: pointer;
1544+
transition: background 0.15s, color 0.15s;
1545+
1546+
&:hover {
1547+
background: var(--global-theme-color);
1548+
color: #fff;
1549+
}
1550+
}
1551+
15191552
.news-meta {
15201553
font-size: 0.72rem;
15211554
text-transform: uppercase;
@@ -1547,14 +1580,14 @@ figure {
15471580

15481581
.news-source {
15491582
display: inline-block;
1550-
font-size: 0.67rem;
1583+
font-size: 0.72rem;
15511584
font-weight: 700;
15521585
text-transform: uppercase;
15531586
letter-spacing: 0.05em;
15541587
color: var(--global-theme-color);
15551588
border: 1px solid color-mix(in srgb, var(--global-theme-color) 40%, transparent);
15561589
border-radius: 3px;
1557-
padding: 0px 4px;
1590+
padding: 1px 5px;
15581591
margin-bottom: 0.32rem;
15591592
}
15601593

@@ -1693,11 +1726,236 @@ figure {
16931726
}
16941727

16951728
.news-latest__strip {
1696-
grid-template-columns: 1fr;
1729+
display: flex;
1730+
flex-wrap: nowrap;
1731+
overflow-x: auto;
1732+
padding-bottom: 0.4rem;
1733+
scrollbar-width: thin;
1734+
-ms-overflow-style: none;
1735+
}
1736+
1737+
.news-latest__item {
1738+
flex: 0 0 220px;
1739+
flex-shrink: 0;
16971740
}
16981741

16991742
.news-section-nav a {
17001743
font-size: 0.7rem;
17011744
padding: 2px 7px;
17021745
}
17031746
}
1747+
1748+
// ═══════════════════════════════════════════════════════════════════════════
1749+
// ── Research page: layout and component patterns (2026 redesign) ───────────
1750+
// ═══════════════════════════════════════════════════════════════════════════
1751+
1752+
// ── 1. Research Program two-column intro grid ──────────────────────────────
1753+
// Text col (left) + aside card (right).
1754+
// Wrapping prose in the text div removes it from `.post article > p`,
1755+
// which has max-width: 72ch via a higher-specificity rule — the grid
1756+
// column fills naturally without that constraint firing.
1757+
.research-intro-grid {
1758+
display: grid;
1759+
grid-template-columns: 1fr 300px;
1760+
gap: 2rem;
1761+
align-items: start;
1762+
margin: 1.5rem 0 2rem;
1763+
1764+
@media (max-width: 900px) {
1765+
grid-template-columns: 1fr;
1766+
gap: 1.25rem;
1767+
}
1768+
}
1769+
1770+
// ── 2. Research Program aside card (right column of intro grid) ───────────
1771+
.research-program-card {
1772+
border: 1px solid var(--global-divider-color);
1773+
border-radius: 6px;
1774+
overflow: hidden;
1775+
background: var(--global-card-bg-color);
1776+
1777+
&__photo {
1778+
overflow: hidden;
1779+
1780+
img {
1781+
width: 100%;
1782+
aspect-ratio: 4 / 3;
1783+
object-fit: cover;
1784+
object-position: center 30%;
1785+
display: block;
1786+
}
1787+
}
1788+
1789+
&__body {
1790+
padding: 0.85rem 1rem;
1791+
border-left: 3px solid #2b6cb0;
1792+
}
1793+
1794+
&__label {
1795+
font-family: "Source Sans 3", sans-serif;
1796+
font-size: 0.72rem;
1797+
font-weight: 700;
1798+
text-transform: uppercase;
1799+
letter-spacing: 0.09em;
1800+
color: #2b6cb0;
1801+
margin: 0 0 0.55rem;
1802+
}
1803+
1804+
&__links {
1805+
list-style: none;
1806+
margin: 0;
1807+
padding: 0;
1808+
font-size: 0.83rem;
1809+
line-height: 1.5;
1810+
1811+
li {
1812+
padding: 0.22rem 0;
1813+
border-bottom: 1px solid var(--global-divider-color);
1814+
1815+
&:last-child {
1816+
border-bottom: none;
1817+
padding-top: 0.45rem;
1818+
font-weight: 600;
1819+
}
1820+
}
1821+
1822+
a {
1823+
color: var(--global-text-color);
1824+
text-decoration: none;
1825+
1826+
&:hover {
1827+
color: var(--global-theme-color);
1828+
}
1829+
}
1830+
}
1831+
}
1832+
1833+
// ── 3. Section fill card ───────────────────────────────────────────────────
1834+
// Insert inside float-context text columns, after prose paragraphs,
1835+
// before <div style="clear:both;">. Fills vertical gap when the right
1836+
// float box is taller than the prose text. Styled to match the existing
1837+
// #2b6cb0 border-left accent system.
1838+
.section-fill-card {
1839+
border-left: 3px solid #2b6cb0;
1840+
padding: 0.65rem 1rem;
1841+
background: color-mix(in srgb, #2b6cb0 5%, var(--global-bg-color) 95%);
1842+
border-radius: 0 4px 4px 0;
1843+
margin-top: 1.25rem;
1844+
font-family: "Source Sans 3", sans-serif;
1845+
1846+
&__label {
1847+
font-size: 0.72rem;
1848+
font-weight: 700;
1849+
text-transform: uppercase;
1850+
letter-spacing: 0.09em;
1851+
color: #2b6cb0;
1852+
margin: 0 0 0.45rem;
1853+
}
1854+
1855+
&__links {
1856+
list-style: none;
1857+
margin: 0;
1858+
padding: 0;
1859+
font-size: 0.82rem;
1860+
line-height: 1.55;
1861+
1862+
li {
1863+
margin-bottom: 0.18rem;
1864+
}
1865+
1866+
a {
1867+
color: var(--global-text-color);
1868+
text-decoration: none;
1869+
1870+
&:hover {
1871+
color: var(--global-theme-color);
1872+
text-decoration: underline;
1873+
text-underline-offset: 0.12em;
1874+
}
1875+
}
1876+
}
1877+
}
1878+
1879+
// ── 4. Photo strip — 2 or 3 images side by side, full column width ─────────
1880+
// Modifier classes --two and --three set column count.
1881+
.photo-strip {
1882+
display: grid;
1883+
gap: 0.5rem;
1884+
margin: 1.75rem 0;
1885+
1886+
&--two { grid-template-columns: 1fr 1fr; }
1887+
&--three { grid-template-columns: 1fr 1fr 1fr; }
1888+
1889+
figure {
1890+
margin: 0;
1891+
overflow: hidden;
1892+
border-radius: 4px;
1893+
1894+
img {
1895+
width: 100%;
1896+
aspect-ratio: 4 / 3;
1897+
object-fit: cover;
1898+
display: block;
1899+
}
1900+
1901+
figcaption {
1902+
font-family: "Source Sans 3", sans-serif;
1903+
font-size: 0.76rem;
1904+
color: var(--global-text-color-light);
1905+
margin-top: 0.3rem;
1906+
line-height: 1.4;
1907+
}
1908+
}
1909+
1910+
@media (max-width: 640px) {
1911+
&--two,
1912+
&--three { grid-template-columns: 1fr; }
1913+
}
1914+
}
1915+
1916+
// ── 5. Fig-crop — remove baked-in white padding from PNG figures ───────────
1917+
// Wrap the <img> in <div class="fig-crop"> (or add class to <figure>).
1918+
// The img is over-sized by 8% and offset negatively, then clipped by
1919+
// overflow:hidden on the container. No transform — avoids sub-pixel blur.
1920+
.fig-crop {
1921+
overflow: hidden;
1922+
border-radius: 4px;
1923+
1924+
img {
1925+
display: block;
1926+
width: 108%;
1927+
margin-left: -4%;
1928+
margin-top: -3%;
1929+
margin-bottom: -3%;
1930+
max-width: none !important; // override Bootstrap .img-fluid
1931+
border-radius: 0; // radius lives on the container
1932+
}
1933+
}
1934+
1935+
// ── 6. Inline concept diagram figure ──────────────────────────────────────
1936+
// For SVG/PNG scientific diagrams placed inline within prose sections.
1937+
.diagram-fig {
1938+
margin: 1.75rem 0;
1939+
overflow: hidden;
1940+
border-radius: 4px;
1941+
background: var(--global-card-bg-color);
1942+
border: 1px solid var(--global-divider-color);
1943+
padding: 1rem;
1944+
text-align: center;
1945+
1946+
img,
1947+
object {
1948+
max-width: 100%;
1949+
height: auto;
1950+
display: block;
1951+
margin: 0 auto;
1952+
}
1953+
1954+
figcaption {
1955+
font-family: "Source Sans 3", sans-serif;
1956+
font-size: 0.78rem;
1957+
color: var(--global-text-color-light);
1958+
margin-top: 0.6rem;
1959+
line-height: 1.4;
1960+
}
1961+
}

0 commit comments

Comments
 (0)