Skip to content

Commit 1f9555a

Browse files
committed
fix(homepage): mobile responsiveness for the landing page
- Stop long doc filenames and the receipt code block from forcing grid columns wider than the screen (min-width on the flow columns, wrapping doc links); no horizontal overflow left from 320px up. - Show the phone preview on small screens instead of hiding it, reusing the existing scale variable so the frame keeps real 375x740 device metrics and its exact proportions, centred even when the column is narrower. - Drop the sticky hold spacer where panels do not pin, removing dead space. - Give the small text controls a 40px hit area on touch screens (doc links, step pills, package files, footer links) without changing their look. - Keep every sync stage legible on stacked layouts, where the section has little scroll travel per stage.
1 parent ede0ca5 commit 1f9555a

1 file changed

Lines changed: 86 additions & 7 deletions

File tree

src/homepage/homepage.css

Lines changed: 86 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,7 @@ body {
641641
}
642642
.hp-sync-receipt pre {
643643
margin: 0;
644+
max-width: 100%;
644645
padding: 12px 14px;
645646
border-radius: 10px;
646647
background: var(--paper);
@@ -732,6 +733,29 @@ body {
732733
}
733734
}
734735

736+
/* Narrow screens: the same visual scale keeps the phone inside the column
737+
without touching the app's own 375x740 layout. */
738+
@media (max-width: 430px) {
739+
.hp-shell {
740+
--hp-phone-scale: 0.94;
741+
}
742+
}
743+
@media (max-width: 400px) {
744+
.hp-shell {
745+
--hp-phone-scale: 0.88;
746+
}
747+
}
748+
@media (max-width: 370px) {
749+
.hp-shell {
750+
--hp-phone-scale: 0.82;
751+
}
752+
}
753+
@media (max-width: 340px) {
754+
.hp-shell {
755+
--hp-phone-scale: 0.74;
756+
}
757+
}
758+
735759
/* ---------- Sticky scrollytelling sections ---------- */
736760
/* A tall band gives the panel room to stay pinned while the reader scrolls
737761
through it, so the section holds still and its sub-sections click through
@@ -826,6 +850,7 @@ body {
826850
.hp-doc-ref-item {
827851
font-size: 0.75rem;
828852
line-height: 1.4;
853+
overflow-wrap: anywhere;
829854
}
830855
.hp-doc-ref a {
831856
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
@@ -868,12 +893,15 @@ section[id] {
868893
}
869894
.hp-flow-copy {
870895
max-width: 500px;
896+
/* Long doc filenames must not force the column wider than the screen. */
897+
min-width: 0;
871898
}
872899
.hp-flow-visual {
873900
display: flex;
874901
justify-content: center;
875902
align-items: flex-start;
876903
width: 100%;
904+
min-width: 0;
877905
}
878906

879907
/* Sub-level under the Guided Flow tab: the supported input types, kept as a
@@ -970,9 +998,12 @@ section[id] {
970998
.hp-iphone-wrap {
971999
display: flex;
9721000
flex-direction: column;
973-
align-items: center;
1001+
align-items: flex-start;
9741002
justify-content: flex-start;
9751003
width: 100%;
1004+
/* The frame keeps a 375px layout box; it must not widen the grid column
1005+
on narrow screens (it is scaled visually to fit instead). */
1006+
min-width: 0;
9761007
/* The frame keeps real 375x740 iPhone metrics so the embedded app lays out
9771008
exactly as it does on device (same container queries, same breakpoints);
9781009
only its drawn size shrinks on short screens. The box is reserved at the
@@ -982,11 +1013,12 @@ section[id] {
9821013
.hp-iphone {
9831014
position: relative;
9841015
width: 375px;
985-
max-width: 100%;
9861016
height: 740px;
9871017
/* Keep the real device box: flex must not shrink it, or the frame distorts.
988-
Only the visual scale changes on short screens. */
1018+
Only the visual scale changes on short screens. Centre it explicitly, so
1019+
it stays centred even when the 375px box is wider than a narrow column. */
9891020
flex: 0 0 auto;
1021+
margin-left: calc((100% - 375px) / 2);
9901022
transform: scale(var(--hp-phone-scale, 1));
9911023
transform-origin: top center;
9921024
border-radius: 48px;
@@ -998,7 +1030,6 @@ section[id] {
9981030
inset 0 0 2px 2px rgba(0, 0, 0, 0.8);
9991031
padding: 9px;
10001032
box-sizing: border-box;
1001-
margin: 0 auto;
10021033
}
10031034
.hp-iphone-dark {
10041035
background: #000000;
@@ -2331,6 +2362,10 @@ section[id] {
23312362
.hp-scrolly-hold {
23322363
height: auto;
23332364
}
2365+
/* Nothing pins here, so the hold spacer would only be dead space. */
2366+
.hp-scrolly-hold::after {
2367+
display: none;
2368+
}
23342369
.hp-scrolly-panel {
23352370
position: static;
23362371
min-height: 0;
@@ -2363,9 +2398,6 @@ section[id] {
23632398
}
23642399

23652400
@media (max-width: 820px) {
2366-
.hp-iphone-wrap {
2367-
display: none;
2368-
}
23692401
.hp-auto-bar,
23702402
.hp-demo-note {
23712403
display: none;
@@ -2541,3 +2573,50 @@ section[id] {
25412573
margin: 6px 0 0;
25422574
line-height: 1.4;
25432575
}
2576+
2577+
/* Touch screens: give the small text controls a comfortable hit area without
2578+
changing how they look. */
2579+
@media (max-width: 820px) {
2580+
.hp-doc-ref {
2581+
gap: 0;
2582+
}
2583+
.hp-doc-ref a {
2584+
display: inline-flex;
2585+
align-items: center;
2586+
min-height: 40px;
2587+
}
2588+
.hp-admin-step-btn {
2589+
min-height: 40px;
2590+
padding: 0 14px;
2591+
}
2592+
.hp-field-types {
2593+
line-height: 2.6;
2594+
}
2595+
.hp-field-type {
2596+
padding: 6px 0;
2597+
}
2598+
.hp-footer-links a {
2599+
min-height: 40px;
2600+
}
2601+
.hp-package-file {
2602+
min-height: 40px;
2603+
}
2604+
.hp-package-copy-btn {
2605+
min-height: 40px;
2606+
}
2607+
.hp-diff-doc-link a,
2608+
.hp-section-note a {
2609+
display: inline-flex;
2610+
align-items: center;
2611+
min-height: 40px;
2612+
}
2613+
.hp-footer-brand .hp-brand {
2614+
min-height: 40px;
2615+
}
2616+
/* Stacked layout leaves little scroll travel per stage, so keep every
2617+
stage legible and let the active one show through its background only. */
2618+
.hp-sync-stage,
2619+
.hp-sync-receipt {
2620+
opacity: 1;
2621+
}
2622+
}

0 commit comments

Comments
 (0)