refactor: every project landing has its own theme

- landing.css is layout only and uses tokens (colors, fonts, hero, nav)
- palettes live in css/landing-<theme>.css; Robotex gets its own dark
  theme, MyPointVPN sets the same tokens
- theme defaults to the project folder name; the build fails if the
  theme file is missing, so a landing can't ship without styles

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
protokeyandClaude Opus 5.5 committed 2026-10-13 21:17:17 +04:00
1 parent d0c0b485c6
commit f7d0f27faa
4 files changed
+66 -40

No files matched your search

+12 -6
View File
@@ -11,8 +11,19 @@
--accent-strong: #0a6e4c;
--lime: #c8f169;
--ink: #0f1a16;
--surface-hover: #fff;
--accent-soft: rgba(13, 138, 95, .1);
--accent-line: var(--accent);
--on-accent: #fff;
--code-bg: #0f1a16;
--code-text: #e9f1ec;
--nav-bg: rgba(246, 244, 238, .85);
--hero-bg:
radial-gradient(40rem 26rem at 85% 20%, rgba(200, 241, 105, .45), transparent 70%),
var(--bg);
--radius: 1.1rem;
font-family: 'Manrope', system-ui, sans-serif;
--font: 'Manrope', system-ui, sans-serif;
--font-mono: 'JetBrains Mono', monospace;
}
.theme-mypointvpn h1,
.theme-mypointvpn h2 { font-family: 'Unbounded', 'Manrope', sans-serif; font-weight: 700; letter-spacing: -.01em; }
@@ -20,7 +31,6 @@
.theme-mypointvpn code { background: rgba(13, 138, 95, .1); padding: .05em .35em; border-radius: .35em; font-size: .9em; }
/* nav */
.theme-mypointvpn .nav { background: rgba(246, 244, 238, .85); }
.theme-mypointvpn .nav__logo { font-family: 'Unbounded', sans-serif; font-weight: 700; }
.theme-mypointvpn .nav__logo::before {
content: ""; display: inline-block; width: .6rem; height: .6rem; margin-right: .5rem;
@@ -31,9 +41,6 @@
/* hero: text left, chat right */
.theme-mypointvpn .hero {
text-align: left;
background:
radial-gradient(40rem 26rem at 85% 20%, rgba(200, 241, 105, .45), transparent 70%),
var(--bg);
}
.theme-mypointvpn .hero--split .wrap {
display: grid; grid-template-columns: 1.15fr 1fr; gap: 3rem; align-items: center;
@@ -43,7 +50,6 @@
.theme-mypointvpn .hero__cta { justify-content: flex-start; }
.theme-mypointvpn .badge { border-color: var(--accent); color: var(--accent-strong); background: var(--surface); }
.theme-mypointvpn .btn { background: var(--surface); border-color: var(--border); color: var(--text); border-radius: 999px; }
.theme-mypointvpn .btn:hover { background: #fff; }
.theme-mypointvpn .btn--primary { background: var(--ink); border-color: var(--ink); color: var(--lime); }
.theme-mypointvpn .btn--primary:hover { background: var(--accent-strong); color: #fff; }
@media (max-width: 820px) {
+26
View File
@@ -0,0 +1,26 @@
/* Robotex theme: dark night blue, indigo accent, centered hero with a glow. */
.theme-robotex {
--bg: #0b1020;
--bg-alt: #10172b;
--surface: rgba(255, 255, 255, .04);
--surface-hover: rgba(255, 255, 255, .08);
--border: rgba(255, 255, 255, .09);
--text: #e6e9f2;
--muted: #9aa3b8;
--accent: #7c8cff;
--accent-strong: #5b6cf0;
--accent-soft: rgba(124, 140, 255, .15);
--accent-line: rgba(124, 140, 255, .4);
--on-accent: #fff;
--code-bg: #070b16;
--code-text: #c9d1e8;
--nav-bg: rgba(11, 16, 32, .8);
--hero-bg:
radial-gradient(60rem 30rem at 50% -10%, rgba(124, 140, 255, .22), transparent 70%),
var(--bg);
--radius: .9rem;
--font: 'Inter', system-ui, sans-serif;
--font-mono: 'JetBrains Mono', monospace;
}
.theme-robotex .engine__callout { background: rgba(124, 140, 255, .06); }
+21 -28
View File
@@ -1,17 +1,12 @@
/* Project landing pages (layouts/projects/single.html). Standalone, no theme CSS. */
:root {
--bg: #0b1020;
--bg-alt: #10172b;
--surface: rgba(255, 255, 255, .04);
--border: rgba(255, 255, 255, .09);
--text: #e6e9f2;
--muted: #9aa3b8;
--accent: #7c8cff;
--accent-strong: #5b6cf0;
--code-bg: #070b16;
--radius: .9rem;
}
/*
Layout only. Every landing has its own theme, css/landing-<theme>.css, which sets
these tokens on .theme-<theme> (and may restyle anything else):
--bg, --bg-alt, --surface, --surface-hover, --border, --text, --muted,
--accent, --accent-strong, --accent-soft (tinted fill), --accent-line (tinted border),
--on-accent, --code-bg, --code-text, --nav-bg, --hero-bg, --radius, --font, --font-mono.
*/
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@@ -19,11 +14,11 @@ body {
margin: 0;
background: var(--bg);
color: var(--text);
font: 400 1rem/1.6 'Inter', system-ui, sans-serif;
font: 400 1rem/1.6 var(--font);
-webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
code, pre { font-family: 'JetBrains Mono', monospace; }
code, pre { font-family: var(--font-mono); }
h1, h2, h3 { letter-spacing: -.02em; line-height: 1.15; margin: 0; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; }
h3 { font-size: 1.05rem; font-weight: 600; }
@@ -33,7 +28,7 @@ h3 { font-size: 1.05rem; font-weight: 600; }
/* nav */
.nav {
position: sticky; top: 0; z-index: 10;
background: rgba(11, 16, 32, .8);
background: var(--nav-bg);
backdrop-filter: blur(10px);
border-bottom: 1px solid var(--border);
}
@@ -50,14 +45,12 @@ h3 { font-size: 1.05rem; font-weight: 600; }
/* hero */
.hero {
padding: clamp(4rem, 12vw, 7.5rem) 0 clamp(3rem, 8vw, 5rem);
background:
radial-gradient(60rem 30rem at 50% -10%, rgba(124, 140, 255, .22), transparent 70%),
var(--bg);
background: var(--hero-bg);
text-align: center;
}
.badge {
display: inline-block; margin: 0 0 1.25rem; padding: .3rem .8rem;
border: 1px solid rgba(124, 140, 255, .4); border-radius: 999px;
border: 1px solid var(--accent-line); border-radius: 999px;
color: var(--accent); font-size: .85rem; font-weight: 600;
}
.hero__title { font-size: clamp(2.2rem, 6vw, 3.6rem); font-weight: 800; max-width: 18ch; margin-inline: auto; }
@@ -70,8 +63,8 @@ h3 { font-size: 1.05rem; font-weight: 600; }
color: var(--text); font-weight: 600; text-decoration: none;
transition: background .15s, transform .15s;
}
.btn:hover { background: rgba(255, 255, 255, .08); transform: translateY(-1px); }
.btn--primary { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.btn:hover { background: var(--surface-hover); transform: translateY(-1px); }
.btn--primary { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent); }
/* sections */
@@ -87,7 +80,7 @@ h3 { font-size: 1.05rem; font-weight: 600; }
.problems li::before {
content: counter(p); flex: none; display: grid; place-items: center;
width: 1.8rem; height: 1.8rem; border-radius: 50%;
background: rgba(124, 140, 255, .15); color: var(--accent); font-weight: 600; font-size: .9rem;
background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: .9rem;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1rem; margin-top: 2rem; }
@@ -96,7 +89,7 @@ h3 { font-size: 1.05rem; font-weight: 600; }
.card p { margin: .5rem 0 0; color: var(--muted); font-size: .95rem; }
.card code { font-size: .85em; color: var(--text); }
.card--link { text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
.card--link:hover { border-color: rgba(124, 140, 255, .5); transform: translateY(-2px); }
.card--link:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.card--link h3 { color: var(--accent); }
.steps { margin: 1.5rem 0 0; padding-left: 1.25rem; display: grid; gap: .4rem; }
@@ -108,7 +101,7 @@ h3 { font-size: 1.05rem; font-weight: 600; }
.code pre {
margin: 0; padding: 1rem; overflow-x: auto;
background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius);
font-size: .82rem; line-height: 1.5; color: #c9d1e8; tab-size: 2;
font-size: .82rem; line-height: 1.5; color: var(--code-text); tab-size: 2;
}
.limits { margin: 1.5rem 0 0; padding-left: 1.25rem; display: grid; gap: .5rem; color: var(--muted); }
@@ -119,10 +112,10 @@ h3 { font-size: 1.05rem; font-weight: 600; }
.footer__row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem; }
.footer p { margin: 0; }
/* under the hood (optional "engine" section; themes may restyle it) */
/* under the hood (optional "engine" section) */
.engine__kicker {
margin: 0 0 .5rem; color: var(--accent);
font: 600 .8rem/1 'JetBrains Mono', monospace; text-transform: uppercase; letter-spacing: .12em;
font: 600 .8rem/1 var(--font-mono); text-transform: uppercase; letter-spacing: .12em;
}
.engine__list {
list-style: none; margin: 2rem 0 0; padding: 0;
@@ -133,8 +126,8 @@ h3 { font-size: 1.05rem; font-weight: 600; }
.engine__list strong { color: var(--text); }
.engine__callout {
margin-top: 2.5rem; padding: 1.25rem 1.5rem;
border: 1px solid rgba(124, 140, 255, .35); border-radius: var(--radius);
background: rgba(124, 140, 255, .06);
border: 1px solid var(--accent-line); border-radius: var(--radius);
background: var(--accent-soft);
}
.engine__callout h3 { color: var(--accent); font-size: 1.1rem; }
.engine__callout p { margin: .5rem 0 0; color: var(--muted); }
+7 -6
View File
@@ -6,11 +6,12 @@
*/ -}}
{{- $p := .Params -}}
{{- $home := cond (eq .Language.Lang hugo.Sites.Default.Language.Lang) "/" (printf "/%s/" .Language.Lang) -}}
{{- $css := resources.Get "css/landing.css" -}}
{{- /* params.theme adds css/landing-<theme>.css on top of the base styles */ -}}
{{- with $p.theme }}{{ with resources.Get (printf "css/landing-%s.css" .) }}
{{- $css = slice $css . | resources.Concat (printf "css/landing-%s.bundle.css" $p.theme) }}
{{- end }}{{ end -}}
{{- /* Every landing has its own theme: css/landing-<theme>.css on top of the layout in
css/landing.css. The theme is params.theme or, by default, the project folder name. */ -}}
{{- $theme := $p.theme | default .File.ContentBaseName -}}
{{- $themeCSS := resources.Get (printf "css/landing-%s.css" $theme) -}}
{{- if not $themeCSS }}{{ errorf "landing %q: theme file assets/css/landing-%s.css not found" .File.Path $theme }}{{ end -}}
{{- $css := slice (resources.Get "css/landing.css") $themeCSS | resources.Concat (printf "css/landing-%s.bundle.css" $theme) -}}
{{- $css = $css | minify | fingerprint -}}
{{- $fonts := $p.fonts | default "family=Inter:wght@400;600;800&family=JetBrains+Mono:wght@400;600" -}}
<!doctype html>
@@ -35,7 +36,7 @@
<link href="https://fonts.googleapis.com/css2?{{ $fonts | safeURL }}&display=swap" rel="stylesheet">
<link rel="stylesheet" href="{{ $css.RelPermalink }}" integrity="{{ $css.Data.Integrity }}">
</head>
<body{{ with $p.theme }} class="theme-{{ . }}"{{ end }}>
<body class="theme-{{ $theme }}">
<header class="nav">
<div class="wrap nav__row">
<a class="nav__logo" href="{{ $home }}">{{ .Title }}</a>