diff --git a/index.html b/index.html index 6f2794f..40edfc1 100644 --- a/index.html +++ b/index.html @@ -31,17 +31,42 @@ --type-scenario: #a855f7; } * { margin: 0; padding: 0; box-sizing: border-box; } -body { font-family: -apple-system, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; } +body { font-family: -apple-system, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; height: 100vh; display: flex; flex-direction: column; overflow: hidden; } /* Header */ -.header { background: var(--header-bg); padding: 28px 24px; text-align: center; border-bottom: 1px solid var(--surface2); position: relative; } -.header h1 { font-size: 26px; font-weight: 700; margin-bottom: 6px; } -.header p { color: rgba(255,255,255,0.7); font-size: 14px; } -.theme-toggle { position: absolute; top: 16px; right: 16px; background: rgba(255,255,255,0.15); border: none; color: white; width: 36px; height: 36px; border-radius: 8px; cursor: pointer; font-size: 18px; transition: background 0.2s; } +.header { + background: var(--header-bg); text-align: center; border-bottom: 1px solid var(--surface2); + --header-pad-y: 28px; + padding: var(--header-pad-y) 24px; + transition: padding 0.3s ease, box-shadow 0.3s ease; + flex-shrink: 0; +} +.header.compact { + --header-pad-y: 8px; + box-shadow: 0 2px 12px rgba(0,0,0,0.25); +} +.header h1 { + font-size: 26px; font-weight: 700; margin-bottom: 6px; + transition: font-size 0.3s ease, margin 0.3s ease; +} +.header.compact h1 { font-size: 18px; margin-bottom: 0; } +.header p { + color: rgba(255,255,255,0.7); font-size: 14px; + transition: opacity 0.25s ease, max-height 0.3s ease, margin 0.3s ease; + max-height: 40px; overflow: hidden; +} +.header.compact p { opacity: 0; max-height: 0; margin: 0; } +.theme-toggle { + position: absolute; top: 16px; right: 16px; + background: rgba(255,255,255,0.15); border: none; color: white; + width: 36px; height: 36px; border-radius: 8px; cursor: pointer; + font-size: 18px; transition: background 0.2s, top 0.3s ease; +} +.header.compact .theme-toggle { top: 8px; } .theme-toggle:hover { background: rgba(255,255,255,0.25); } /* Layout */ -.app { display: flex; height: calc(100vh - 100px); } +.app { display: flex; flex: 1; min-height: 0; } .sidebar { width: 280px; background: var(--surface); border-right: 1px solid var(--surface2); padding: 16px; overflow-y: auto; flex-shrink: 0; } .main { flex: 1; padding: 24px; overflow-y: auto; } @@ -1066,8 +1091,22 @@ function escapeHtml(s) { return s.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"'); } +// ─── Scroll: compact header on scroll ─── +function setupHeaderScroll() { + const main = document.getElementById('mainContent'); + const header = document.querySelector('.header'); + if (!main || !header) return; + + const THRESHOLD = 60; + + main.addEventListener('scroll', () => { + header.classList.toggle('compact', main.scrollTop > THRESHOLD); + }, { passive: true }); +} + // ─── Start ─── init(); +setupHeaderScroll();