feat: hobby project landing page (PWA + SPA) with admin backoffice
- landing page: welcome hero, live search, project card grid (10 projects from owner list) - warm brown/white theme (fastwork-inspired layout), embedded K2D Thai font - PWA: manifest, PIL-generated icons, versioned service worker with auto-update - backoffice at #/admin: edit name/description/url, reorder, delete, publish - server/publish.mjs: zero-dependency static server + PUT api/projects with validation, JSON write, git commit and push; loopback-only unless ADMIN_TOKEN - docs: README, DESIGN.md (color/type contract), AGENTS.md
This commit is contained in:
1 parent
e55b193644
commit
c00bc62272
35 files changed
+3432
-2
No files matched your search
@@ -0,0 +1,503 @@
|
||||
/* ==========================================================================
|
||||
theme.css — โทเคนสี/ตัวอักษร/ส่วนประกอบที่ใช้ร่วมทุกหน้า
|
||||
โทน: น้ำตาลโมก้า-คาราเมล + ขาว (ธีมอ้างอิงโครงจาก fastwork.com)
|
||||
หมายเหตุ: สีน้ำตาลทุกตัวคุมให้ "สด-สว่าง" ไม่เป็นน้ำตาลซีเปีย/แก่
|
||||
========================================================================== */
|
||||
|
||||
@font-face {
|
||||
font-family: "K2D";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url("../../fonts/k2d-400-thai.woff2") format("woff2");
|
||||
unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "K2D";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url("../../fonts/k2d-400-latin-ext.woff2") format("woff2");
|
||||
unicode-range: U+0100-024F, U+1E00-1EFF;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "K2D";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url("../../fonts/k2d-400-latin.woff2") format("woff2");
|
||||
unicode-range: U+0000-00FF, U+2010-2027;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "K2D";
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
font-display: swap;
|
||||
src: url("../../fonts/k2d-500-thai.woff2") format("woff2");
|
||||
unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "K2D";
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
font-display: swap;
|
||||
src: url("../../fonts/k2d-500-latin-ext.woff2") format("woff2");
|
||||
unicode-range: U+0100-024F, U+1E00-1EFF;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "K2D";
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
font-display: swap;
|
||||
src: url("../../fonts/k2d-500-latin.woff2") format("woff2");
|
||||
unicode-range: U+0000-00FF, U+2010-2027;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "K2D";
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: url("../../fonts/k2d-700-thai.woff2") format("woff2");
|
||||
unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "K2D";
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: url("../../fonts/k2d-700-latin-ext.woff2") format("woff2");
|
||||
unicode-range: U+0100-024F, U+1E00-1EFF;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "K2D";
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: url("../../fonts/k2d-700-latin.woff2") format("woff2");
|
||||
unicode-range: U+0000-00FF, U+2010-2027;
|
||||
}
|
||||
|
||||
:root {
|
||||
/* --- คู่สีหลัก (ตรวจคอนทราสต์บน #FFFFFF แล้ว) --- */
|
||||
--brand-50: #fdf7f2;
|
||||
--brand-100: #faeadf;
|
||||
--brand-200: #f3d5c1;
|
||||
--brand-300: #e8b695;
|
||||
--brand-400: #d99368; /* 2.52:1 — ใช้เป็นกราฟิกเท่านั้น ห้ามใช้เป็นตัวอักษร */
|
||||
--brand-500: #c4703c; /* 3.66:1 — เส้น/ไอคอน/พื้นการ์ด */
|
||||
--brand-600: #a85a2c; /* 5.04:1 — ตัวอักษรบนขาวผ่าน AA */
|
||||
--brand-700: #8a4722; /* 6.99:1 — ปุ่มหลัก/ลิงก์ */
|
||||
--brand-800: #6b3620; /* 9.66:1 */
|
||||
--brand-900: #3d241a; /* 14.33:1 — หัวข้อ */
|
||||
|
||||
--background: #ffffff;
|
||||
--surface: #ffffff;
|
||||
--surface-2: #fbf6f1;
|
||||
--foreground: #241a15;
|
||||
--muted-foreground: #6f6159; /* 5.95:1 */
|
||||
--border: #eadfd6;
|
||||
--border-strong: #dccaba;
|
||||
--ring: #a85a2c;
|
||||
--on-brand: #ffffff;
|
||||
|
||||
/* --- ระยะ/มุม --- */
|
||||
--space-1: 4px;
|
||||
--space-2: 8px;
|
||||
--space-3: 12px;
|
||||
--space-4: 16px;
|
||||
--space-5: 20px;
|
||||
--space-6: 24px;
|
||||
--space-8: 32px;
|
||||
--space-10: 40px;
|
||||
--space-12: 48px;
|
||||
--space-16: 64px;
|
||||
--space-20: 80px;
|
||||
|
||||
--radius-sm: 8px;
|
||||
--radius-md: 12px;
|
||||
--radius-lg: 16px;
|
||||
--radius-xl: 22px;
|
||||
--radius-pill: 999px;
|
||||
|
||||
--wrap: 1120px;
|
||||
--header-h: 64px;
|
||||
|
||||
--shadow-sm: 0 1px 2px rgba(61, 36, 26, 0.06);
|
||||
--shadow-md: 0 6px 18px -6px rgba(61, 36, 26, 0.18);
|
||||
--shadow-lg: 0 18px 40px -18px rgba(61, 36, 26, 0.28);
|
||||
|
||||
--ease: cubic-bezier(0.22, 0.61, 0.36, 1);
|
||||
}
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html {
|
||||
-webkit-text-size-adjust: 100%;
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
min-height: 100dvh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: var(--background);
|
||||
color: var(--foreground);
|
||||
font-family: "K2D", "Noto Sans Thai", "Sarabun", system-ui, -apple-system, sans-serif;
|
||||
font-size: 16px;
|
||||
line-height: 1.6;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
p,
|
||||
figure {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4 {
|
||||
color: var(--brand-900);
|
||||
font-weight: 700;
|
||||
line-height: 1.25;
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--brand-700);
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 3px;
|
||||
}
|
||||
|
||||
img,
|
||||
svg {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
button,
|
||||
input,
|
||||
textarea,
|
||||
select {
|
||||
font: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
:focus-visible {
|
||||
outline: 3px solid var(--brand-600);
|
||||
outline-offset: 2px;
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
|
||||
.wrap {
|
||||
width: 100%;
|
||||
max-width: var(--wrap);
|
||||
margin-inline: auto;
|
||||
padding-inline: var(--space-5);
|
||||
}
|
||||
|
||||
.site-main {
|
||||
flex: 1 0 auto;
|
||||
padding-block: var(--space-10) var(--space-16);
|
||||
}
|
||||
.site-main:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.skip-link {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: -100px;
|
||||
transform: translateX(-50%);
|
||||
z-index: 30;
|
||||
padding: 10px 18px;
|
||||
border-radius: var(--radius-pill);
|
||||
background: var(--brand-700);
|
||||
color: var(--on-brand);
|
||||
font-weight: 500;
|
||||
transition: top 160ms var(--ease);
|
||||
}
|
||||
.skip-link:focus {
|
||||
top: 10px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------- header */
|
||||
.site-header {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 20;
|
||||
background: rgba(255, 255, 255, 0.92);
|
||||
backdrop-filter: blur(10px);
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.site-header__inner {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--space-4);
|
||||
min-height: var(--header-h);
|
||||
}
|
||||
|
||||
.brand {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
color: var(--brand-700);
|
||||
text-decoration: none;
|
||||
}
|
||||
.brand:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
.brand__mark svg {
|
||||
color: var(--brand-700);
|
||||
}
|
||||
.brand__text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
line-height: 1.15;
|
||||
}
|
||||
.brand__text strong {
|
||||
font-size: 17px;
|
||||
color: var(--brand-900);
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
.brand__text small {
|
||||
font-size: 12px;
|
||||
color: var(--muted-foreground);
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
.site-nav {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
.site-nav__link {
|
||||
display: none;
|
||||
padding: 8px 12px;
|
||||
border-radius: var(--radius-sm);
|
||||
color: var(--muted-foreground);
|
||||
font-weight: 500;
|
||||
font-size: 15px;
|
||||
}
|
||||
.site-nav__link:hover {
|
||||
color: var(--brand-800);
|
||||
background: var(--brand-50);
|
||||
text-decoration: none;
|
||||
}
|
||||
.site-nav__link[aria-current="page"] {
|
||||
color: var(--brand-800);
|
||||
background: var(--brand-100);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------- buttons */
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
min-height: 44px;
|
||||
padding: 10px 20px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: var(--radius-pill);
|
||||
background: transparent;
|
||||
color: var(--foreground);
|
||||
font-weight: 500;
|
||||
font-size: 15px;
|
||||
line-height: 1.2;
|
||||
cursor: pointer;
|
||||
transition:
|
||||
background 160ms var(--ease),
|
||||
border-color 160ms var(--ease),
|
||||
color 160ms var(--ease),
|
||||
transform 160ms var(--ease),
|
||||
box-shadow 160ms var(--ease);
|
||||
}
|
||||
.btn:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
.btn:active {
|
||||
transform: translateY(1px);
|
||||
}
|
||||
.btn[disabled] {
|
||||
opacity: 0.55;
|
||||
cursor: not-allowed;
|
||||
transform: none;
|
||||
}
|
||||
.btn--primary {
|
||||
background: var(--brand-700);
|
||||
color: var(--on-brand);
|
||||
box-shadow: var(--shadow-sm);
|
||||
}
|
||||
.btn--primary:hover {
|
||||
background: var(--brand-800);
|
||||
box-shadow: var(--shadow-md);
|
||||
}
|
||||
.btn--ghost {
|
||||
background: #fff;
|
||||
border-color: var(--border-strong);
|
||||
color: var(--brand-800);
|
||||
}
|
||||
.btn--ghost:hover {
|
||||
background: var(--brand-50);
|
||||
border-color: var(--brand-300);
|
||||
}
|
||||
.btn--quiet {
|
||||
background: var(--brand-50);
|
||||
color: var(--brand-800);
|
||||
}
|
||||
.btn--quiet:hover {
|
||||
background: var(--brand-100);
|
||||
}
|
||||
.btn--danger {
|
||||
background: #fff;
|
||||
border-color: #e7c4bb;
|
||||
color: #8f2c19;
|
||||
}
|
||||
.btn--danger:hover {
|
||||
background: #fdf1ee;
|
||||
border-color: #d0a094;
|
||||
}
|
||||
.btn--sm {
|
||||
min-height: 40px;
|
||||
padding: 8px 14px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.btn--icon {
|
||||
width: 40px;
|
||||
min-height: 40px;
|
||||
padding: 0;
|
||||
border-radius: var(--radius-md);
|
||||
}
|
||||
.btn svg {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
flex: none;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------- footer */
|
||||
.site-footer {
|
||||
border-top: 1px solid var(--border);
|
||||
background: var(--surface-2);
|
||||
padding-block: var(--space-10);
|
||||
font-size: 14px;
|
||||
}
|
||||
.site-footer__inner {
|
||||
display: grid;
|
||||
gap: var(--space-6);
|
||||
}
|
||||
.site-footer__brand {
|
||||
font-weight: 700;
|
||||
color: var(--brand-900);
|
||||
font-size: 15px;
|
||||
}
|
||||
.site-footer__title {
|
||||
font-weight: 500;
|
||||
color: var(--brand-800);
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
.site-footer__note {
|
||||
color: var(--muted-foreground);
|
||||
max-width: 34ch;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------- toast */
|
||||
.toast-stack {
|
||||
position: fixed;
|
||||
inset-inline: 0;
|
||||
bottom: 20px;
|
||||
z-index: 40;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding-inline: var(--space-4);
|
||||
pointer-events: none;
|
||||
}
|
||||
.toast {
|
||||
max-width: 92vw;
|
||||
padding: 12px 18px;
|
||||
border-radius: var(--radius-pill);
|
||||
background: var(--brand-900);
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
box-shadow: var(--shadow-lg);
|
||||
animation: toast-in 200ms var(--ease);
|
||||
}
|
||||
.toast--error {
|
||||
background: #7d2617;
|
||||
}
|
||||
@keyframes toast-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(8px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
.noscript {
|
||||
padding-block: var(--space-10);
|
||||
color: var(--brand-800);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------- helpers */
|
||||
.visually-hidden {
|
||||
position: absolute !important;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
clip-path: inset(50%);
|
||||
white-space: nowrap;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
@media (min-width: 640px) {
|
||||
.site-footer__inner {
|
||||
grid-template-columns: 1.4fr 1fr 1fr;
|
||||
gap: var(--space-8);
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 900px) {
|
||||
:root {
|
||||
--header-h: 72px;
|
||||
}
|
||||
.site-nav__link {
|
||||
display: inline-flex;
|
||||
}
|
||||
.site-main {
|
||||
padding-block: var(--space-12) var(--space-20);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
html {
|
||||
scroll-behavior: auto;
|
||||
}
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
animation-duration: 0.001ms !important;
|
||||
animation-iteration-count: 1 !important;
|
||||
transition-duration: 0.001ms !important;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user