Optzimize responsive styling
This commit is contained in:
+12
-51
@@ -53,9 +53,12 @@
|
||||
--gutter: clamp(1rem, 4vw, 2.5rem);
|
||||
--header-height: 7rem;
|
||||
--header-height-scrolled: 5rem;
|
||||
--radius-lg: 60px;
|
||||
--radius-md: 30px;
|
||||
/* Large decorative corners (hero, header, search panel): grows with the
|
||||
viewport instead of switching at breakpoints */
|
||||
--radius-lg: min(15vw, 180px);
|
||||
--radius-sm: 15px;
|
||||
/* How far photos are pulled up into the hero */
|
||||
--hero-overlap: clamp(6rem, 11.25vw, 9rem);
|
||||
/* Dropdown submenus (Example, language) */
|
||||
--radius-menu: 8px;
|
||||
--transition: 0.3s ease-in-out;
|
||||
@@ -190,21 +193,10 @@ button:hover .arrow {
|
||||
========================================================================== */
|
||||
|
||||
.page-hero {
|
||||
--hero-veil: linear-gradient(
|
||||
90deg,
|
||||
rgba(0, 0, 74, 0.72) 0%,
|
||||
rgba(0, 0, 74, 0.45) 45%,
|
||||
rgba(0, 0, 74, 0) 75%
|
||||
);
|
||||
|
||||
margin-top: calc(-1 * var(--header-height));
|
||||
padding: calc(var(--header-height) + 3rem) 0 12rem;
|
||||
padding: calc(var(--header-height) + 3rem) 0 calc(var(--hero-overlap) + 3rem);
|
||||
color: var(--white);
|
||||
background:
|
||||
var(--grain),
|
||||
linear-gradient(180deg, rgba(0, 0, 74, 0.55) 0, rgba(0, 0, 74, 0) 10rem),
|
||||
var(--hero-veil),
|
||||
#00004a;
|
||||
background: var(--grain), var(--galaxy-blue);
|
||||
border-bottom-right-radius: var(--radius-lg);
|
||||
}
|
||||
|
||||
@@ -265,7 +257,7 @@ button:hover .arrow {
|
||||
|
||||
/* Photo pulled up over the hero; flat, no shadow */
|
||||
.page-figure {
|
||||
margin: -9rem 0 4rem;
|
||||
margin: calc(-1 * var(--hero-overlap)) 0 4rem;
|
||||
}
|
||||
|
||||
.page-figure img {
|
||||
@@ -279,12 +271,13 @@ button:hover .arrow {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
/* Two photos side by side, pulled up over the hero together */
|
||||
/* Two photos side by side (Home), pulled up over the hero together; they
|
||||
stack by themselves once each would be narrower than 18rem */
|
||||
.page-figures {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
|
||||
gap: 1.5rem;
|
||||
margin: -9rem 0 4rem;
|
||||
margin: calc(-1 * var(--hero-overlap)) 0 4rem;
|
||||
}
|
||||
|
||||
.page-figures .page-figure {
|
||||
@@ -448,38 +441,6 @@ button:hover .arrow {
|
||||
filter: brightness(1.1);
|
||||
}
|
||||
|
||||
/* Responsive page
|
||||
========================================================================== */
|
||||
|
||||
@media (max-width: 800px) {
|
||||
/* Text spans the full width here, so keep at least 50% navy everywhere */
|
||||
.page-hero {
|
||||
--hero-veil: linear-gradient(
|
||||
90deg,
|
||||
rgba(0, 0, 74, 0.72) 0%,
|
||||
rgba(0, 0, 74, 0.5) 100%
|
||||
);
|
||||
|
||||
padding-bottom: 8rem;
|
||||
border-bottom-right-radius: var(--radius-md);
|
||||
}
|
||||
|
||||
.page-hero--compact {
|
||||
padding-bottom: 4rem;
|
||||
}
|
||||
|
||||
.page-figure,
|
||||
.page-figures {
|
||||
margin-top: -6rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.page-figures {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
/* Preferences
|
||||
========================================================================== */
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ const between = (start, end) => {
|
||||
const preview = [
|
||||
between('/* ===', '/* Header'), // fonts, tokens, base, utilities
|
||||
between('/* Page hero', '/* Footer'), // hero, figure, prose, buttons
|
||||
between('/* Responsive page'), // responsive page, preferences
|
||||
between('/* Preferences'), // high contrast, reduced motion
|
||||
`/* Preview frame
|
||||
========================================================================== */
|
||||
|
||||
|
||||
+15
-73
@@ -51,9 +51,10 @@
|
||||
--gutter: clamp(1rem, 4vw, 2.5rem);
|
||||
--header-height: 7rem;
|
||||
--header-height-scrolled: 5rem;
|
||||
--radius-lg: 60px;
|
||||
--radius-md: 30px;
|
||||
--radius-lg: min(15vw, 180px);
|
||||
--radius-sm: 15px;
|
||||
/* How far photos are pulled up into the hero */
|
||||
--hero-overlap: clamp(6rem, 11.25vw, 9rem);
|
||||
/* Dropdown submenus (Example, language) */
|
||||
--radius-menu: 8px;
|
||||
--transition: 0.3s ease-in-out;
|
||||
@@ -206,7 +207,7 @@ button:hover .arrow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 1.5rem;
|
||||
gap: clamp(0.5rem, 4vw, 1.5rem);
|
||||
width: min(100% - 2 * var(--gutter), var(--content-width));
|
||||
height: var(--header-height);
|
||||
margin-inline: auto;
|
||||
@@ -223,8 +224,8 @@ button:hover .arrow {
|
||||
}
|
||||
|
||||
.site-header__logo img {
|
||||
width: 153px;
|
||||
height: 46px;
|
||||
width: clamp(120px, 32vw, 153px);
|
||||
height: auto;
|
||||
}
|
||||
|
||||
/* Submenus: one disclosure dropdown shared by Example and the language menu
|
||||
@@ -380,7 +381,7 @@ button:hover .arrow {
|
||||
display: flex;
|
||||
flex: 0 0 auto;
|
||||
align-items: center;
|
||||
gap: 0.625rem;
|
||||
gap: clamp(0.25rem, 1.5vw, 0.625rem);
|
||||
}
|
||||
|
||||
.pill {
|
||||
@@ -503,7 +504,7 @@ button:hover .arrow {
|
||||
}
|
||||
|
||||
.site-header:not(.is-open) {
|
||||
border-bottom-right-radius: var(--radius-md);
|
||||
border-bottom-right-radius: var(--radius-lg);
|
||||
}
|
||||
|
||||
.site-header__signin {
|
||||
@@ -580,42 +581,14 @@ button:hover .arrow {
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.site-header__logo img {
|
||||
width: 120px;
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 359px) {
|
||||
.site-header__inner {
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.site-header__tools {
|
||||
gap: 0.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Page hero
|
||||
========================================================================== */
|
||||
|
||||
.page-hero {
|
||||
--hero-veil: linear-gradient(
|
||||
90deg,
|
||||
rgba(0, 0, 74, 0.72) 0%,
|
||||
rgba(0, 0, 74, 0.45) 45%,
|
||||
rgba(0, 0, 74, 0) 75%
|
||||
);
|
||||
|
||||
margin-top: calc(-1 * var(--header-height));
|
||||
padding: calc(var(--header-height) + 3rem) 0 12rem;
|
||||
padding: calc(var(--header-height) + 3rem) 0 calc(var(--hero-overlap) + 3rem);
|
||||
color: var(--white);
|
||||
background:
|
||||
var(--grain),
|
||||
linear-gradient(180deg, rgba(0, 0, 74, 0.55) 0, rgba(0, 0, 74, 0) 10rem),
|
||||
var(--hero-veil),
|
||||
#00004a;
|
||||
background: var(--grain), var(--galaxy-blue);
|
||||
border-bottom-right-radius: var(--radius-lg);
|
||||
}
|
||||
|
||||
@@ -676,7 +649,7 @@ button:hover .arrow {
|
||||
|
||||
/* Photo pulled up over the hero; flat, no shadow */
|
||||
.page-figure {
|
||||
margin: -9rem 0 4rem;
|
||||
margin: calc(-1 * var(--hero-overlap)) 0 4rem;
|
||||
}
|
||||
|
||||
.page-figure img {
|
||||
@@ -690,12 +663,13 @@ button:hover .arrow {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
/* Two photos side by side (Home), pulled up over the hero together */
|
||||
/* Two photos side by side (Home), pulled up over the hero together; they
|
||||
stack by themselves once each would be narrower than 18rem */
|
||||
.page-figures {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
|
||||
gap: 1.5rem;
|
||||
margin: -9rem 0 4rem;
|
||||
margin: calc(-1 * var(--hero-overlap)) 0 4rem;
|
||||
}
|
||||
|
||||
.page-figures .page-figure {
|
||||
@@ -914,38 +888,6 @@ main {
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
}
|
||||
|
||||
/* Responsive page
|
||||
========================================================================== */
|
||||
|
||||
@media (max-width: 800px) {
|
||||
/* Text spans the full width here, so keep at least 50% navy everywhere */
|
||||
.page-hero {
|
||||
--hero-veil: linear-gradient(
|
||||
90deg,
|
||||
rgba(0, 0, 74, 0.72) 0%,
|
||||
rgba(0, 0, 74, 0.5) 100%
|
||||
);
|
||||
|
||||
padding-bottom: 8rem;
|
||||
border-bottom-right-radius: var(--radius-md);
|
||||
}
|
||||
|
||||
.page-hero--compact {
|
||||
padding-bottom: 4rem;
|
||||
}
|
||||
|
||||
.page-figure,
|
||||
.page-figures {
|
||||
margin-top: -6rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.page-figures {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
/* Preferences
|
||||
========================================================================== */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user