From bd1c979f1ae53406f6cc39b57397b5b19524e9b4 Mon Sep 17 00:00:00 2001 From: Kunthawat Greethong Date: Tue, 9 Jun 2026 20:00:52 +0700 Subject: [PATCH] fix(home): remove wrapper around bento-tile (was breaking grid) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The home service section had each bento-tile wrapped in an tag. This caused two problems: 1. The became the grid item instead of the .bento-tile, so the .bento-tile's grid-column: span 3 was ignored. The defaulted to display: block and stretched to 100% width, so all 4 tiles in a row had the same wide width — but the grid was no longer dividing them equally. 2. Astro's scoped CSS only applies to elements with the matching data-astro-cid attribute. The wrapper had its own scope, and the .bento-grid > a selector wasn't styled — so the grid layout didn't propagate correctly. Fix: remove the wrapper. Make the whole tile clickable by adding an absolutely-positioned inside the tile (covers the entire tile, sits behind text via z-index). The .bento-tile is now a direct child of .bento-grid and grid-column: span 3 works as expected. Result: 4 tiles width 3/12 each, exactly filling one row, clickable from anywhere on the tile. Co-Authored-By: Claude --- src/pages/index.astro | 18 +++++++++--------- src/styles/global.css | 28 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/src/pages/index.astro b/src/pages/index.astro index fa75c22..b529620 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -148,16 +148,16 @@ const featuredPortfolio = portfolio.filter(p => p.data.featured).slice(0, 4); const span = 3; const surface = (['yellow', 'purple-soft', 'mint', 'soft'] as const)[i]; return ( - - -

{s.data.subtitle}

-
- เป้าหมาย: - {s.data.objective} -
+ +

{s.data.subtitle}

+
+ เป้าหมาย: + {s.data.objective} +
+
ดูรายละเอียด → - - + + ); })} diff --git a/src/styles/global.css b/src/styles/global.css index fa217aa..3a235cd 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -843,6 +843,34 @@ p { min-height: 380px; display: flex; flex-direction: column; + position: relative; + overflow: hidden; + transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease; +} + +/* Invisible overlay link — makes the whole tile clickable + without breaking the bento-grid layout (no wrapping) */ +.tile-link-overlay { + position: absolute; + inset: 0; + z-index: 1; + text-decoration: none; + color: inherit; + display: flex; + align-items: flex-end; + padding: 32px; +} +.tile-link-overlay .mega-cta { + margin-top: 0; + font-weight: 700; +} +.bento-tile > *:not(.tile-link-overlay) { + position: relative; + z-index: 2; +} +.bento-tile:hover { + transform: translateY(-4px); + box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08); } /* Make tile-body grow to push CTA to bottom */