diff --git a/src/app/globals.css b/src/app/globals.css index 1f10d7d..b74edf4 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -19,6 +19,41 @@ --font: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif; } +/* Dark theme โ€” applied when data-theme="dark" is set on (by the no-flash script / toggle). */ +:root[data-theme="dark"] { + --bg: #17141f; + --surface: #221d31; + --ink: #f2eefb; + --ink-soft: #aaa2c0; + --primary: #7b9bff; + --primary-dark: #9db4ff; + --accent: #ff8ec0; + --sun: #ffce5b; + --sea: #43d3d3; + --leaf: #5fd083; + --danger: #ff7a7a; + --line: #36304a; + --shadow: 0 8px 24px rgba(0, 0, 0, 0.45); +} +/* No-JS / pre-hydration fallback to the system preference */ +@media (prefers-color-scheme: dark) { + :root:not([data-theme]) { + --bg: #17141f; + --surface: #221d31; + --ink: #f2eefb; + --ink-soft: #aaa2c0; + --primary: #7b9bff; + --primary-dark: #9db4ff; + --accent: #ff8ec0; + --sun: #ffce5b; + --sea: #43d3d3; + --leaf: #5fd083; + --danger: #ff7a7a; + --line: #36304a; + --shadow: 0 8px 24px rgba(0, 0, 0, 0.45); + } +} + * { box-sizing: border-box; } html, body { @@ -74,7 +109,7 @@ a { color: var(--primary-dark); } } .btn:active { transform: translateY(1px) scale(0.99); } .btn:hover { filter: brightness(1.04); } -.btn.secondary { background: #fff; color: var(--primary-dark); border: 2px solid var(--line); box-shadow: none; } +.btn.secondary { background: var(--surface); color: var(--primary-dark); border: 2px solid var(--line); box-shadow: none; } .btn.accent { background: var(--accent); } .btn.ghost { background: transparent; color: var(--ink); box-shadow: none; } .btn.danger { background: var(--danger); } @@ -90,7 +125,7 @@ a { color: var(--primary-dark); } /* Top navigation */ .nav { position: sticky; top: 0; z-index: 20; - background: rgba(254, 249, 243, 0.9); backdrop-filter: blur(8px); + background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); } .nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; max-width: var(--maxw); margin: 0 auto; } @@ -98,7 +133,7 @@ a { color: var(--primary-dark); } .brand .logo { font-size: 1.5rem; } .nav-links { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .nav-links a { text-decoration: none; color: var(--ink); font-weight: 700; padding: 8px 14px; border-radius: 999px; border: 2px solid transparent; } -.nav-links a:hover { background: #fff; color: var(--ink); } +.nav-links a:hover { background: var(--surface); color: var(--ink); } /* Current page: lighter fill, darker bold text for clear, readable contrast */ .nav-links a.active { background: #eaf0ff; color: var(--ink); font-weight: 800; } /* Sign-up call-to-action: outlined so it doesn't read as the active page */ @@ -112,7 +147,7 @@ a { color: var(--primary-dark); } .field input, .field select, .field textarea { font: inherit; padding: 14px 16px; min-height: 52px; border: 2px solid var(--line); border-radius: var(--radius-sm); - background: #fff; color: var(--ink); width: 100%; + background: var(--surface); color: var(--ink); width: 100%; } .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); } .field textarea { min-height: 110px; resize: vertical; } diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 8db110a..84275a4 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -44,9 +44,15 @@ export const viewport: Viewport = { themeColor: "#dce06b", }; +// Runs before paint to set the theme (avoids a flash of the wrong colors). +const themeScript = `(function(){try{var p=localStorage.getItem('drawit-theme')||'system';var d=p==='dark'||(p==='system'&&window.matchMedia('(prefers-color-scheme: dark)').matches);document.documentElement.setAttribute('data-theme',d?'dark':'light');}catch(e){}})();`; + export default function RootLayout({ children }: { children: React.ReactNode }) { return ( - + + +