From 5e300c84fa0717ad8c01f6d5db96bf710939ad81 Mon Sep 17 00:00:00 2001 From: LordSchmackes Date: Sun, 22 Mar 2026 23:15:45 +0100 Subject: [PATCH] Refactor homepage mobile content layout --- assets/style.css | 132 +++++++++++++++++++++++++++++++++ index.php | 188 +++++++++++++++++++++++++++++++++++++---------- 2 files changed, 280 insertions(+), 40 deletions(-) diff --git a/assets/style.css b/assets/style.css index 296e59b..6b0852d 100644 --- a/assets/style.css +++ b/assets/style.css @@ -632,6 +632,104 @@ img, picture { display: block; max-width: 100%; height: auto; } } .hero-card__body { padding: 18px; display: grid; gap: 10px; } +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border: 0; +} + +.discover-shell { + max-width: 1200px; + margin: 24px auto 40px; + display: grid; + grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr); + gap: 24px; + align-items: stretch; +} +.discover-shell__main, +.tag-panel, +.empty-state, +.quick-start { + background: var(--surface); + border: 1px solid var(--stroke); + border-radius: var(--radius); + box-shadow: var(--shadow); +} +.discover-shell__main { + padding: 22px; + display: grid; + gap: 18px; +} +.section-header--stack { + flex-direction: column; + align-items: flex-start; + text-align: left; +} +.discover-search { + margin: 0; +} +.discover-stats { + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 12px; +} +.discover-stat { + padding: 14px; + background: var(--panel); + border: 1px solid var(--stroke); + border-radius: 14px; + display: grid; + gap: 4px; +} +.discover-stat strong { + font-size: clamp(1.1rem, 2vw, 1.5rem); +} +.discover-stat span { + color: var(--muted); + font-size: 14px; +} +.tag-panel { + padding: 16px; + display: grid; + gap: 12px; + box-shadow: none; + border-radius: 16px; +} +.tag-panel__head { + display: flex; + justify-content: space-between; + align-items: center; + gap: 12px; +} +.tag-panel__head h3 { + margin: 0; +} +.tag-row--panel { + margin-top: 0; +} +.quick-start { + max-width: 1200px; + margin: 0 auto 40px; + padding: 22px; + display: grid; + gap: 18px; +} +.empty-state { + padding: 22px; + display: grid; + gap: 12px; + text-align: center; +} +.empty-state h3, +.empty-state p { + margin: 0; +} .section-header { max-width: 1200px; margin: 0 auto 12px; @@ -824,6 +922,40 @@ img, picture { display: block; max-width: 100%; height: auto; } #backToTop.show { opacity: 1; transform: translateY(0); } #backToTop:hover { background: var(--panel-2); } +@media (max-width: 900px) { + .discover-shell { + grid-template-columns: 1fr; + gap: 16px; + margin: 16px auto 32px; + } + + .discover-shell__main, + .quick-start, + .coming-features, + .empty-state { + padding: 18px; + } + + .discover-stats { + grid-template-columns: 1fr; + } + + .tag-panel__head { + flex-direction: column; + align-items: flex-start; + } +} + +@media (max-width: 480px) { + .discover-shell__main, + .quick-start, + .coming-features, + .empty-state, + .tag-panel { + padding: 14px; + } +} + /* ══════════════════════════════════════════════════════════════════ RESPONSIVE ══════════════════════════════════════════════════════════════════ */ diff --git a/index.php b/index.php index 0c7f63a..41d4e5c 100644 --- a/index.php +++ b/index.php @@ -108,6 +108,46 @@ $navHome = $t['home']; $navLatest = $t['latest']; $navBasics = $t['basics']; +$quickStartRecipes = array_slice($recipes, 0, 3); +$latestRecipes = array_slice($recipes, 0, 6); +$recipeCount = count($recipes); +$totalMinutes = array_sum(array_map(fn($recipe) => (int) ($recipe['total_time'] ?? 0), $recipes)); +$averageMinutes = $recipeCount > 0 ? (int) ceil($totalMinutes / $recipeCount) : 0; +$activeTag = $tag !== '' ? $tag : null; +$tagCount = count($allTags); + +$copy['en'] += [ + 'discover_title' => 'Find your next easy favorite.', + 'discover_text' => 'Everything below the landing area is simplified for smaller screens: search, tap a tag, and jump into a recipe without cramped text blocks.', + 'browse_tags' => 'Browse tags', + 'quick_start_title' => 'Quick start', + 'quick_start_text' => 'Open one of the recipes with the shortest path from craving to plate.', + 'library_title' => 'Recipe library', + 'library_text' => 'Clean cards, shorter descriptions, and tap-friendly actions for mobile browsing.', + 'stats_recipes' => 'live recipes', + 'stats_average' => 'avg. total time', + 'stats_tags' => 'browseable tags', + 'empty_title' => 'No recipes found yet', + 'empty_text' => 'Try another search term or clear the active tag to see every recipe again.', + 'view_recipe' => 'View recipe', +]; +$copy['de'] += [ + 'discover_title' => 'Finde schnell dein nächstes Lieblingsrezept.', + 'discover_text' => 'Alles unterhalb der Landingpage ist für kleine Screens vereinfacht: suchen, Tag antippen und ohne gequetschte Textblöcke ins Rezept springen.', + 'browse_tags' => 'Tags entdecken', + 'quick_start_title' => 'Schnell starten', + 'quick_start_text' => 'Öffne eines der Rezepte mit dem kürzesten Weg von Appetit zu Teller.', + 'library_title' => 'Rezeptübersicht', + 'library_text' => 'Saubere Karten, kürzere Beschreibungen und gut tappbare Aktionen für Mobile.', + 'stats_recipes' => 'Rezepte online', + 'stats_average' => 'Ø Gesamtzeit', + 'stats_tags' => 'durchsuchbare Tags', + 'empty_title' => 'Noch keine Rezepte gefunden', + 'empty_text' => 'Probiere einen anderen Suchbegriff oder entferne den aktiven Tag, um wieder alle Rezepte zu sehen.', + 'view_recipe' => 'Rezept ansehen', +]; +$t = $copy[$lang]; + // Small helpers for URLs $langQuery = ['lang' => $lang]; $recipeUrl = fn(array $recipe) => '/recipe.php?' . http_build_query(['slug' => $recipe['slug']] + $langQuery); @@ -197,77 +237,145 @@ document.getElementById('landingCta').addEventListener('click', function(e){ -
-
-

-

-

- -
-
-

-

+
+
+

+

-
- + +
+
+
+
+

+

+

+
+ + +
+ + + +
+ +
+

+

+ +
+ +
+
-
+

-- 2.54.0