diff --git a/board/board.css b/board/board.css index 342d0ef..19c7f49 100644 --- a/board/board.css +++ b/board/board.css @@ -5,9 +5,12 @@ --teal: #1F6F78; --teal-deep: #174F56; --buoy: #E8A33D; - /* Boat slots on the water: a boat's width and one slot row's height. */ + /* Boat slots on the water: a boat's width and one slot row's height. + board.js may shrink --slot-h / --boat-w / --hull-* so the harbour fits the viewport. */ --boat-w: 120px; --slot-h: 176px; + --hull-w: 96px; + --hull-h: 72px; --paper: #F6F2EA; --sand: #E8D9BB; --quay: #B98B5E; @@ -18,8 +21,8 @@ --sans: 'Atkinson Hyperlegible', system-ui, sans-serif; } * { box-sizing: border-box; } -html, body { margin: 0; min-height: 100%; } -body { background: var(--water-b); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; } +html, body { margin: 0; height: 100%; } +body { background: var(--water-b); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; overflow: hidden; } a { color: var(--teal); } a:hover { color: var(--teal-deep); } button { font: inherit; color: inherit; } @@ -43,9 +46,9 @@ button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px soli @keyframes beam { 0%,100% { opacity: .15 } 50% { opacity: .75 } } @keyframes arrive { from { transform: translateX(-70px); opacity: 0 } to { transform: none; opacity: 1 } } -/* Layout: water on the left, the shore on the right. */ -.harbour { position: relative; display: flex; min-height: 100vh; overflow: clip; background: linear-gradient(90deg, var(--water-a) 0%, var(--water-b) 48%, var(--water-c) 100%); } -.water { position: relative; flex: 1 1 auto; min-width: 0; padding: 22px 0 96px 36px; display: flex; flex-direction: column; gap: 22px; } +/* Layout: water on the left, the shore on the right. Locked to the viewport so the harbour never scrolls. */ +.harbour { position: relative; display: flex; height: 100%; height: 100dvh; max-height: 100dvh; overflow: clip; background: linear-gradient(90deg, var(--water-a) 0%, var(--water-b) 48%, var(--water-c) 100%); } +.water { position: relative; flex: 1 1 auto; min-width: 0; min-height: 0; height: 100%; padding: 16px 0 20px 36px; display: flex; flex-direction: column; gap: 12px; overflow: hidden; } .sea { position: absolute; inset: 0; overflow: hidden; pointer-events: none; } .sea .cloud { position: absolute; left: 0; width: 420px; height: 200px; border-radius: 50%; background: radial-gradient(closest-side, rgba(23,43,51,.07), transparent); animation: cloud linear infinite; } .sea .wave { position: absolute; left: 0; animation: drift linear infinite; } @@ -54,53 +57,57 @@ button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px soli .sea .gull { position: absolute; left: 0; animation: glide linear infinite; } .sea .gull svg { animation: flap .7s ease-in-out infinite; transform-origin: 50% 60%; } -.brand { position: relative; display: flex; align-items: center; gap: 10px; } +.brand { position: relative; display: flex; align-items: center; gap: 10px; flex: none; } .brand span { font-family: var(--serif); font-size: 28px; font-weight: 600; letter-spacing: -.5px; } .brand-me { display: none; margin-left: auto; } .toolbar { display: none; } -h1 { position: relative; margin: 0; font-family: var(--serif); font-weight: 600; font-size: 46px; line-height: 1.05; letter-spacing: -1px; } -.empty { position: relative; margin: 0; max-width: 520px; font-size: 17px; line-height: 1.5; } -.legend { position: relative; margin: -8px 0 0; max-width: 520px; font-size: 13px; line-height: 1.4; color: #1E4A51; opacity: .78; } -.stale { position: relative; margin: 0; align-self: flex-start; font-size: 14px; background: rgba(255,253,248,.85); border-radius: 999px; padding: 6px 14px; } +h1 { position: relative; margin: 0; font-family: var(--serif); font-weight: 600; font-size: clamp(28px, 4.6vh, 46px); line-height: 1.05; letter-spacing: -1px; flex: none; } +.empty { position: relative; margin: 0; max-width: 520px; font-size: 17px; line-height: 1.5; flex: none; } +.legend { position: relative; margin: -4px 0 0; max-width: 520px; font-size: 13px; line-height: 1.4; color: #1E4A51; opacity: .78; flex: none; } +.stale { position: relative; margin: 0; align-self: flex-start; font-size: 14px; background: rgba(255,253,248,.85); border-radius: 999px; padding: 6px 14px; flex: none; } .scrim { display: none; } -main { position: relative; display: flex; flex-direction: column; } -.lane { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 34px 0 12px; } -.lane:first-child { padding-top: 8px; } -.lane.has-break { padding-bottom: 34px; } -.lane h2 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 24px; } +main { position: relative; display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; } +.lane { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 10px 0 8px; flex: 1 1 0; min-height: 0; justify-content: flex-start; } +.lane:first-child { padding-top: 4px; } +.lane.has-break { padding-bottom: 22px; } +.lane h2 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: clamp(18px, 2.4vh, 24px); flex: none; } .quay { position: absolute; top: 10px; bottom: 12px; right: 22px; width: 46px; background: var(--quay); background-image: repeating-linear-gradient(180deg, transparent 0 20px, #9C7148 20px 23px); box-shadow: -6px 6px 0 rgba(23,43,51,.08); } .pilings { position: absolute; top: 10px; bottom: 12px; right: 70px; width: 10px; background-image: radial-gradient(circle, #6E4E30 4px, transparent 4.6px); background-size: 10px 52px; background-position: 0 14px; } -.zones { display: grid; grid-template-columns: minmax(0,6fr) minmax(0,4fr) minmax(0,3fr); gap: 22px; height: calc(42px + 2 * var(--slot-h) + 6px); padding-right: 92px; transition: grid-template-columns 1.2s cubic-bezier(.42,0,.28,1); } -.zone { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; } +.zones { display: grid; grid-template-columns: minmax(0,6fr) minmax(0,4fr) minmax(0,3fr); gap: 22px; height: calc(36px + 2 * var(--slot-h) + 4px); max-height: 100%; padding-right: 92px; transition: grid-template-columns 1.2s cubic-bezier(.42,0,.28,1); min-height: 0; } +.zone { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; min-height: 0; } .zone .floats { position: absolute; top: -44px; bottom: -14px; left: -14px; width: 8px; background-image: radial-gradient(circle, #FFFDF8 3px, transparent 3.6px); background-size: 8px 22px; opacity: .9; } -.zone-label { align-self: flex-start; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: #1E4A51; background: rgba(255,253,248,.72); border-radius: 999px; padding: 5px 8px 5px 14px; } +.zone-label { align-self: flex-start; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: #1E4A51; background: rgba(255,253,248,.72); border-radius: 999px; padding: 4px 8px 4px 12px; flex: none; } .zone-label .n { min-width: 22px; height: 22px; border-radius: 999px; background: rgba(23,43,51,.08); font-size: 12px; display: inline-flex; align-items: center; justify-content: center; } .zone-label .n.hot { background: var(--buoy); } /* Two rows of boat slots per lane; board.js sets the slot columns (they overlap when a column is - narrow) and the zone widths, which transition. */ -.boats { display: grid; grid-template-columns: var(--boat-w); grid-template-rows: repeat(2, var(--slot-h)); grid-auto-flow: row; gap: 6px 0; align-items: start; } + narrow) and the zone widths, which transition. It also shrinks --slot-h to fit the viewport. */ +.boats { display: grid; grid-template-columns: var(--boat-w); grid-template-rows: repeat(2, var(--slot-h)); grid-auto-flow: row; gap: 4px 0; align-items: start; min-height: 0; } .zone.beres .boats { justify-content: end; } -.breakwater { position: absolute; left: 84px; right: 0; bottom: -14px; height: 28px; z-index: 2; border-radius: 14px 0 0 14px; background-color: #A89E8C; background-image: radial-gradient(ellipse 11px 9px at 50% 45%, #C9C0AE 92%, transparent 100%); background-size: 26px 28px; box-shadow: 0 6px 0 rgba(23,43,51,.08); } +.breakwater { position: absolute; left: 84px; right: 0; bottom: -10px; height: 24px; z-index: 2; border-radius: 14px 0 0 14px; background-color: #A89E8C; background-image: radial-gradient(ellipse 11px 9px at 50% 45%, #C9C0AE 92%, transparent 100%); background-size: 26px 24px; box-shadow: 0 6px 0 rgba(23,43,51,.08); } .breakwater svg { position: absolute; left: -2px; top: -44px; overflow: visible; } .breakwater .beam { animation: beam 2.4s ease-in-out infinite; } /* Boats */ -.boat { position: relative; background: transparent; border: 0; border-radius: 18px; padding: 4px 2px 8px; width: var(--boat-w); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; } +.boat { position: relative; background: transparent; border: 0; border-radius: 18px; padding: 2px 2px 4px; width: var(--boat-w); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; } .boat.dim { opacity: .42; } .boat.needs:not(.dim) .chip { box-shadow: 0 0 0 2px var(--buoy); } .boat.done { opacity: .8; } -.boat .hull { display: block; position: relative; width: 96px; height: 72px; animation: float 4.6s ease-in-out infinite; transform-origin: 50% 85%; transition: filter .2s ease; } +.boat .hull { display: block; position: relative; width: var(--hull-w); height: var(--hull-h); animation: float 4.6s ease-in-out infinite; transform-origin: 50% 85%; transition: filter .2s ease; } +.boat .hull svg { width: 100%; height: 100%; display: block; } .boat.done .hull { animation-name: calm; animation-duration: 6s; } .boat .flag { animation: flag 2.2s ease-in-out infinite; transform-box: fill-box; transform-origin: left center; } -.boat .shade { display: block; width: 84px; height: 8px; margin-top: -10px; border-radius: 50%; background: rgba(23,43,51,.16); animation: shadow 4.6s ease-in-out infinite; } +.boat .shade { display: block; width: calc(var(--hull-w) * 0.875); height: 8px; margin-top: -10px; border-radius: 50%; background: rgba(23,43,51,.16); animation: shadow 4.6s ease-in-out infinite; } .boat.picked .shade { background: rgba(255,255,255,.95); } .boat:hover .hull { filter: brightness(1.06); animation-duration: 2.2s; } -.boat .chip { font-size: 13px; font-weight: 700; line-height: 1.2; text-align: center; padding: 4px 10px; border-radius: 10px; background: rgba(255,253,248,.82); overflow-wrap: anywhere; } +.boat .chip { font-size: 13px; font-weight: 700; line-height: 1.2; text-align: center; padding: 3px 8px; border-radius: 10px; background: rgba(255,253,248,.82); overflow-wrap: anywhere; } .boat.picked .chip { background: var(--teal); color: #fff; box-shadow: none; } .boat .boat-title { max-width: 100%; font-size: 11px; line-height: 1.25; text-align: center; color: #1E4A51; opacity: .9; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; } .boat.picked .boat-title { color: var(--ink); opacity: 1; } -.boat .marks { display: flex; align-items: center; justify-content: center; gap: 8px; height: 16px; } +.boat .marks { display: flex; align-items: center; justify-content: center; gap: 8px; height: 14px; } +/* Short viewports: drop the title so a shrunk slot still holds the hull + chip. */ +html[data-boat-compact="1"] .boat .boat-title { display: none; } +html[data-boat-compact="1"] .boat .marks { height: 12px; } .boat .anchor { position: absolute; left: -10px; top: 40px; animation: sway 3s ease-in-out infinite; transform-origin: 18px 0; } .boat .buoy { position: absolute; right: -6px; top: 46px; width: 18px; height: 22px; animation: float 3.4s ease-in-out infinite; } .boat .buoy .ring { position: absolute; left: 1px; top: 7px; width: 16px; height: 16px; border-radius: 50%; background: var(--buoy); animation: pulse 1.8s ease-out infinite; } @@ -113,9 +120,9 @@ main { position: relative; display: flex; flex-direction: column; } .dots i:nth-child(3) { animation-delay: .4s; } /* Shore */ -/* Desktop: the shore stays put at screen height and only its detail scrolls, so the harbour never moves with it. */ -.shore { position: sticky; top: 0; align-self: flex-start; z-index: 1; flex: 0 0 420px; height: 100vh; height: 100dvh; background-color: var(--paper); background-image: radial-gradient(#E2D8C6 1.2px, transparent 1.4px); background-size: 24px 24px; } -.shore-inner { position: relative; height: 100%; display: flex; flex-direction: column; gap: 28px; padding: 22px 0 0 30px; } +/* Desktop: the shore matches the harbour height; only its detail pane scrolls. */ +.shore { position: relative; align-self: stretch; z-index: 1; flex: 0 0 420px; min-height: 0; background-color: var(--paper); background-image: radial-gradient(#E2D8C6 1.2px, transparent 1.4px); background-size: 24px 24px; } +.shore-inner { position: relative; height: 100%; display: flex; flex-direction: column; gap: 20px; padding: 18px 0 0 30px; min-height: 0; } .shore-inner aside { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 28px 32px 0; scrollbar-gutter: stable; } .shore .edge { position: absolute; left: -44px; top: 0; width: 64px; height: 100%; pointer-events: none; } .shore .edge .foam { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; vector-effect: non-scaling-stroke; animation: foam 5s ease-in-out infinite; } @@ -182,34 +189,39 @@ aside { min-width: 0; } .shore-inner aside, .shore-top { padding-right: 20px; } .water { padding-left: 24px; } .zones { gap: 14px; } - :root { --boat-w: 104px; } + :root { --boat-w: 104px; --hull-w: 84px; --hull-h: 63px; } } -/* Phone: one harbour scene + bottom sheet from the shore. */ +/* Phone: one harbour scene + bottom sheet from the shore. Locked to the viewport like desktop. */ @media (max-width: 899px) { + html, body { height: 100%; overflow: hidden; } + body.sheet-open { overflow: hidden; } .harbour { display: block; - min-height: 100vh; - min-height: 100dvh; + height: 100%; + height: 100dvh; + max-height: 100dvh; + min-height: 0; background: linear-gradient(180deg, var(--water-a) 0%, var(--water-b) 55%, var(--water-c) 100%); - overflow: visible; + overflow: hidden; } .water { - padding: 14px 16px 0; - gap: 12px; - min-height: 100vh; - min-height: 100dvh; + padding: 10px 16px 0; + gap: 8px; + height: 100%; + min-height: 0; + overflow: hidden; display: flex; flex-direction: column; } - .brand { padding-top: env(safe-area-inset-top); } + .brand { padding-top: env(safe-area-inset-top); flex: none; } .brand span { font-size: 22px; } .brand { width: 100%; } .brand-me { display: block; margin: 0 0 0 auto; } .brand-me .avatar { width: 40px; height: 40px; } - h1 { font-size: 28px; letter-spacing: -.5px; max-width: 18ch; } + h1 { font-size: clamp(22px, 7vw, 28px); letter-spacing: -.5px; max-width: 18ch; flex: none; } .legend { display: none; } - .empty { font-size: 15px; } + .empty { font-size: 15px; flex: none; } .toolbar { display: flex; @@ -217,6 +229,7 @@ aside { min-width: 0; } align-items: center; gap: 8px; position: relative; + flex: none; } .toolbar[hidden] { display: none !important; } .dermaga { @@ -256,21 +269,30 @@ aside { min-width: 0; } padding: 0; flex: 1 1 auto; min-height: 0; + justify-content: stretch; display: flex; flex-direction: column; } + .zones { height: auto; max-height: none; } + :root, html { + --boat-w: 108px; + --slot-h: 176px; + --hull-w: 88px; + --hull-h: 66px; + } + html[data-boat-compact] .boat .boat-title { display: none; } /* Full-bleed harbour so the camera pan clips at the screen edge, not the padded water. */ main#lanes { position: relative; flex: 1 1 auto; - min-height: 280px; + min-height: 0; display: flex; flex-direction: column; margin: 0 -16px; width: calc(100% + 32px); overflow: hidden; } - .phone-harbour { overflow: visible; } + .phone-harbour { overflow: hidden; min-height: 0; } /* Dual-scene camera pan: both harbours stay mounted so a reverse tap can retarget. */ main#lanes.lane-panning { display: block; @@ -285,58 +307,62 @@ aside { min-width: 0; } } .stale { margin: 0 16px 12px; align-self: center; } - /* One water plane: Dicek high, Siap mid, Beres near the sand. */ + /* One water plane: Dicek high, Siap mid, Beres near the sand. Fills leftover height; boats scale via --hull-*. */ .harbour-scene { position: relative; flex: 1 1 auto; - min-height: 300px; + min-height: 0; + height: 100%; display: grid; grid-template-rows: 1fr 1.15fr 1fr auto; - padding: 4px 16px 0; + padding: 2px 16px 0; } .band { position: relative; z-index: 1; min-width: 0; + min-height: 0; display: flex; align-items: center; justify-content: center; + overflow: hidden; } - .band-cek { align-items: flex-end; padding-bottom: 4px; } + .band-cek { align-items: flex-end; padding-bottom: 2px; } .band-siap { align-items: center; } - .band-beres { align-items: flex-start; padding-top: 6px; } + .band-beres { align-items: flex-start; padding-top: 2px; } .band .boats { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; - gap: 4px 14px; + gap: 2px 10px; width: 100%; - overflow: visible; + overflow: hidden; padding: 0 4px; margin: 0; } .beach { - height: 28px; - margin: 8px -16px 0; + height: 22px; + margin: 4px -16px 0; width: calc(100% + 32px); border-radius: 40% 40% 0 0 / 100% 100% 0 0; background: linear-gradient(180deg, #E4D4B0 0%, var(--sand) 55%, #DFCDA3 100%); box-shadow: 0 -8px 18px rgba(23, 43, 51, .06); + flex: none; } .boat { flex: 0 0 auto; - width: 108px; + width: var(--boat-w); min-height: 0; - padding: 4px 2px 2px; - gap: 2px; + padding: 2px 2px 0; + gap: 1px; } - .boat .hull { width: 88px; height: 66px; } - .boat .hull svg { width: 88px; height: 66px; } + .boat .hull { width: var(--hull-w); height: var(--hull-h); } + .boat .hull svg { width: 100%; height: 100%; } .boat .boat-title { display: none; } .boat .chip { font-size: 12px; - padding: 5px 10px; + padding: 4px 8px; background: rgba(255, 253, 248, .88); box-shadow: 0 4px 12px rgba(23, 43, 51, .08); } @@ -461,7 +487,7 @@ aside { min-width: 0; } } /* Gate and rubric pages */ -.page-gate, .page-rubric { background: var(--paper); min-height: 100vh; color: var(--ink); font-family: var(--sans); } +body.page-gate, body.page-rubric { height: auto; overflow: auto; background: var(--paper); min-height: 100vh; color: var(--ink); font-family: var(--sans); } .page-gate main { max-width: 440px; margin: 0 auto; padding: 16vh 20px 40px; display: flex; flex-direction: column; gap: 18px; } .page-gate .brand { margin-bottom: 8px; } .page-gate .brand span { font-family: var(--serif); font-size: 28px; font-weight: 600; letter-spacing: -.5px; } diff --git a/board/board.js b/board/board.js index 0baad49..6b031d0 100644 --- a/board/board.js +++ b/board/board.js @@ -235,16 +235,85 @@ const beresWidth = (boatW) => BERES_PER_ROW * boatW + (BERES_PER_ROW - 1) * SLOT_GAP; + // Shrink slot and boat sizes so every lane / phone scene fits inside the viewport. + const SLOT_MAX = 176; + const SLOT_MIN = 100; + const BOAT_NATURAL = 158; // hull + chip + title + marks at full size (desktop) + const PHONE_BOAT = 112; // hull + chip + marks at phone defaults + function clearFitVars(root) { + root.style.removeProperty('--slot-h'); + root.style.removeProperty('--boat-w'); + root.style.removeProperty('--hull-w'); + root.style.removeProperty('--hull-h'); + delete root.dataset.boatCompact; + } + function applyBoatScale(root, scale, baseBoat, baseHullW, baseHullH) { + if (scale >= 0.995) return; + root.style.setProperty('--boat-w', `${Math.max(64, Math.round(baseBoat * scale))}px`); + root.style.setProperty('--hull-w', `${Math.max(48, Math.round(baseHullW * scale))}px`); + root.style.setProperty('--hull-h', `${Math.max(36, Math.round(baseHullH * scale))}px`); + } + function layoutPhoneFit(root) { + const scene = document.querySelector('.harbour-scene'); + if (!scene) { + clearFitVars(root); + return; + } + clearFitVars(root); + const baseBoat = parseFloat(getComputedStyle(root).getPropertyValue('--boat-w')) || 108; + const baseHullW = parseFloat(getComputedStyle(root).getPropertyValue('--hull-w')) || 88; + const baseHullH = parseFloat(getComputedStyle(root).getPropertyValue('--hull-h')) || 66; + const beach = scene.querySelector('.beach'); + const avail = scene.clientHeight - (beach ? beach.offsetHeight : 22); + if (avail < 60) return; + // Grid rows are 1fr / 1.15fr / 1fr — size boats to the mid band. + const midBand = avail * (1.15 / 3.15); + const scale = Math.min(1, Math.max(0.55, (midBand - 6) / PHONE_BOAT)); + applyBoatScale(root, scale, baseBoat, baseHullW, baseHullH); + } + function layoutFit() { + const root = document.documentElement; + if (phone.matches) { + layoutPhoneFit(root); + return; + } + const main = $('lanes'); + const n = main.querySelectorAll('.lane').length; + if (!n) { + clearFitVars(root); + return; + } + // Read the stylesheet defaults (after clearing any previous inline shrink) so a roomy + // window can grow back to full size, and narrow-laptop media rules still apply. + clearFitVars(root); + const baseBoat = parseFloat(getComputedStyle(root).getPropertyValue('--boat-w')) || 120; + const baseHullW = parseFloat(getComputedStyle(root).getPropertyValue('--hull-w')) || 96; + const baseHullH = parseFloat(getComputedStyle(root).getPropertyValue('--hull-h')) || 72; + const avail = main.clientHeight; + if (avail < 80) return; + // Per lane: h2 + paddings + zone-label row + boat-row gap, then two slot rows. + const laneChrome = 28 + 26 + 36 + 4; + const slot = Math.max(SLOT_MIN, Math.min(SLOT_MAX, Math.floor((avail / n - laneChrome) / ROWS))); + root.style.setProperty('--slot-h', `${slot}px`); + // When the slot is shorter than a full boat, scale the boat and drop the title. + const boatH = Math.min(BOAT_NATURAL, slot - 4); + const scale = Math.min(1, boatH / BOAT_NATURAL); + root.dataset.boatCompact = scale < 0.92 ? '1' : '0'; + applyBoatScale(root, scale, baseBoat, baseHullW, baseHullH); + } + // Places the boats already in `rows` (one grid per lane) and sizes the columns. function layoutColumns() { const rows = [...$('lanes').querySelectorAll('.zones')]; - if (!rows.length) return; if (phone.matches) { + layoutFit(); for (const r of rows) r.style.gridTemplateColumns = ''; for (const b of $('lanes').querySelectorAll('.boats')) b.style.gridTemplateColumns = ''; state.cols = null; return; } + if (!rows.length) return; + layoutFit(); const { total, boatW } = measure(rows[0]); const count = (z) => Math.max(1, ...rows.map((r) => r.children[z].querySelector('.boats').childElementCount)); const beres = beresWidth(boatW); @@ -360,6 +429,7 @@ keep.style.transform = ''; main.classList.remove('lane-panning'); main.style.height = ''; + layoutFit(); } function panPhoneHarbour(main, dir) { const target = state.lane; @@ -371,6 +441,7 @@ if (calm.matches) { main.classList.remove('lane-panning'); main.replaceChildren(buildPhoneScene(target)); + layoutFit(); return; } @@ -495,9 +566,11 @@ main.classList.remove('lane-panning'); if (!state.lane) { main.replaceChildren(); + clearFitVars(document.documentElement); return; } main.replaceChildren(buildPhoneScene(state.lane)); + layoutFit(); } let drawnLanes = ''; @@ -571,7 +644,8 @@ } for (const b of main.querySelectorAll('.boat[data-id]')) shown.add(b.dataset.id); // Boats take their new slots at once; the columns then widen or narrow through their - // transition, and every boat glides from where it was. + // transition, and every boat glides from where it was. layoutColumns fits height first + // so the shrunk boat width is what the columns measure. layoutColumns(); sail(new Map([...before].map(([id, b]) => [id, b.rect]))); depart(before, shown);