Skip to content

Commit b192fdd

Browse files
authored
fix(theme): responsive figure bleed and overflow guards (#8)
Eliminates horizontal scroll at sub-1280px desktop widths and stops figure bleed from colliding with the post-meta-rail. Tokenizes gutter/bleed into CSS variables, lets the grid 1fr column actually shrink, and clips body overflow with `clip` (preserves sticky rails). - Add --gutter, --bleed-x, --bleed-x-small tokens - min-width: 0 on grid items so embeds/iframes/pre stop flooring the track - Tapered figure bleed: 0 / -16px / -32px at 880 / 1199 / 1200+ — 4px buffer to both rails at every desktop breakpoint - max-width: 100% guard on .post-body img/video/iframe/embeds/twitter - html, body { overflow-x: clip } safety net - Merge duplicate @media (max-width: 1100px) blocks - Drop redundant masthead horizontal padding and unused .util-btn border-radius: 0
1 parent f2c12fa commit b192fdd

2 files changed

Lines changed: 38 additions & 14 deletions

File tree

assets/css/custom.css

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
/* Legacy container/header/nav/theme-toggle/site-main removed — newspaper masthead + .util-btn handle it. */
77

8+
/* Safety net for intentional figure bleeds — `clip` (not `hidden`) preserves
9+
position: sticky on the post-meta-rail and toc-rail. */
10+
html, body { overflow-x: clip; }
11+
812
/* Minimal entry-content guards retained for Gutenberg-rendered prose. */
913
.entry-content { max-width: 100%; word-wrap: break-word; }
1014
.entry-content > *:first-child { margin-top: 0; }
@@ -491,7 +495,7 @@ pre code {
491495
}
492496

493497
.serif { font-family: "Fraunces", serif; font-feature-settings: "ss01"; }
494-
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 32px; }
498+
.wrap { max-width: var(--max-width); margin: 0 auto; padding: 0 var(--gutter); }
495499
.site-main { padding: 0; min-height: 60vh; }
496500

497501
.ticker {
@@ -511,7 +515,7 @@ pre code {
511515
.ticker-track .dot { color: var(--hot); margin: 0 0.6em; }
512516
@keyframes ticker-slide { from { transform: translateX(0); } to { transform: translateX(-100%); } }
513517

514-
.masthead { border-bottom: 2px solid var(--rule); padding: 28px 32px 18px; position: relative; }
518+
.masthead { border-bottom: 2px solid var(--rule); padding-top: 28px; padding-bottom: 18px; position: relative; }
515519
.mast-row { display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: 32px; }
516520
.brand { display: flex; align-items: baseline; gap: 14px; }
517521
.brand-logo {
@@ -540,7 +544,6 @@ pre code {
540544
.util-btn {
541545
background: transparent;
542546
border: 1.5px solid var(--rule);
543-
border-radius: 0;
544547
color: var(--ink);
545548
padding: 8px 12px;
546549
font-family: inherit;
@@ -585,7 +588,8 @@ pre code {
585588
.nav-status { display: inline-flex; align-items: center; gap: 8px; padding: 14px 22px; font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.06em; }
586589
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bleed); display: inline-block; }
587590

588-
.layout { display: grid; grid-template-columns: 220px 1fr 240px; gap: 36px; padding: 36px 32px 80px; }
591+
.layout { display: grid; grid-template-columns: 220px 1fr 240px; gap: 36px; padding: 36px var(--gutter) 80px; }
592+
.layout > * { min-width: 0; }
589593
.main { min-width: 0; }
590594
.rail { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--ink-soft); }
591595
.rail-block { padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px dashed var(--rule); }
@@ -645,7 +649,23 @@ pre code {
645649
.stamp { border: 2px solid var(--bleed); color: var(--bleed); padding: 12px 14px; font-family: "JetBrains Mono", monospace; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; transform: rotate(-2deg); text-align: center; font-weight: 600; line-height: 1.3; }
646650
.stamp .big { display: block; font-size: 22px; font-family: "Fraunces", serif; font-weight: 900; letter-spacing: -0.02em; margin: 4px 0; }
647651

648-
.single.wrap { display: grid; grid-template-columns: 220px 1fr 240px; gap: 36px; padding: 36px 32px 100px; }
652+
.single.wrap { display: grid; grid-template-columns: 220px 1fr 240px; gap: 36px; padding: 36px var(--gutter) 100px; }
653+
/* Grid items default to min-width: auto, which floors the 1fr track at
654+
min-content. Embeds, wide images, and unwrappable <pre> blocks push that
655+
floor past the viewport — overriding here lets the column actually shrink. */
656+
.single.wrap > *,
657+
.single-post,
658+
.post-body,
659+
.post-meta-rail,
660+
.toc-rail { min-width: 0; }
661+
.post-body img,
662+
.post-body video,
663+
.post-body iframe,
664+
.post-body .wp-block-embed,
665+
.post-body .wp-block-embed__wrapper,
666+
.post-body blockquote.twitter-tweet,
667+
.about-author { max-width: 100%; }
668+
.about-meta { min-width: 0; }
649669
.post-meta-rail, .toc-rail { font-family: "JetBrains Mono", monospace; font-size: 11px; position: sticky; top: 24px; align-self: start; }
650670
.post-back { font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--ink-mute); text-decoration: none; text-transform: uppercase; letter-spacing: 0.08em; display: inline-block; margin-bottom: 24px; }
651671
.post-back:hover { color: var(--bleed); }
@@ -711,11 +731,16 @@ pre code {
711731
/* Code blocks — consistent vertical spacing regardless of Gutenberg wrapper. */
712732
.post-body pre { margin: 1.6em 0; }
713733

714-
/* Figure bleed only when side rails are present (≥920px). Below that, keep
715-
figures inside the prose column so they don't overhang the page padding. */
734+
/* Figure bleed tapers with available space:
735+
– ≤880px: in column (no bleed)
736+
– 881–1199px: gentle bleed into the rail gap
737+
– ≥1200px: full editorial bleed */
716738
.post-body figure { margin: 1.8em 0; font-family: "JetBrains Mono", monospace; }
717-
@media (min-width: 920px) {
718-
.post-body figure { margin: 2.2em -40px; }
739+
@media (min-width: 881px) {
740+
.post-body figure { margin: 2.0em calc(-1 * var(--bleed-x-small)); }
741+
}
742+
@media (min-width: 1200px) {
743+
.post-body figure { margin: 2.2em calc(-1 * var(--bleed-x)); }
719744
}
720745
.post-body figure img, .post-body p > img, .entry-featured-image img { display: block; max-width: 100%; width: 100%; height: auto; border: 1.5px solid var(--rule); border-radius: 0; background: var(--paper-dark); }
721746

@@ -939,15 +964,12 @@ pre code {
939964
.lede-title { font-size: 40px; }
940965
.post-headline { font-size: 44px; }
941966
.footer-grid { grid-template-columns: 1fr 1fr; }
942-
}
943-
944-
@media (max-width: 1100px) {
945967
.archive-title { font-size: 38px; }
946968
.proj-grid { grid-template-columns: 1fr; }
947969
}
948970

949971
@media (max-width: 760px) {
950-
.wrap, .masthead, .layout, .single.wrap { padding-left: 16px; padding-right: 16px; }
972+
:root { --gutter: 16px; }
951973
.ticker { font-size: 10px; }
952974
.masthead { padding-top: 18px; padding-bottom: 14px; }
953975
.mast-row { display: block; }
@@ -968,7 +990,6 @@ pre code {
968990
.month-rule .ruling, .month-rule .rhs { display: none; }
969991
.post-headline { font-size: 40px; }
970992
.post-body { font-size: 18px; }
971-
.post-body figure { margin-left: 0; margin-right: 0; }
972993
.about-author { grid-template-columns: 1fr; }
973994
.footer-grid { grid-template-columns: 1fr; }
974995
.footer-foot { display: block; }

style.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ Tags: blog, minimal, dark-mode, code, technical
7878
/* Layout */
7979
--max-width: 1280px;
8080
--max-width-prose: 700px;
81+
--gutter: 32px; /* horizontal page gutter, overridden at narrow widths */
82+
--bleed-x: 32px; /* figure bleed at ≥1200px (fits inside 36px rail gap) */
83+
--bleed-x-small: 16px; /* figure bleed 881–1199px */
8184

8285
/* Spacing */
8386
--spacing-xs: 0.5rem;

0 commit comments

Comments
 (0)