The user wants me to design a web carbon footprint reduction program. This is a technical/ecological topic that needs a professional, modern, and somewhat "technical" aesthetic. Let me think about what this should include:
- Asset Optimization - Images, fonts, scripts optimization
- CPU Budgeting - Performance budgets, JavaScript execution limits
- Browser Energy Telemetry - Real-time energy monitoring
Key sections I should include:
- Hero with compelling stats/visualization
- Real-time energy telemetry dashboard
- Asset optimization analyzer
- CPU budget tracker
- Carbon calculator/savings
- Interactive charts/visualizations
Design direction:
- Aesthetic: Technical/industrial with ecological undertones - think dark mode with green accents (eco + tech)
- Typography: Something technical/monospace for data + a clean display font
- Colors: Dark base with bright green/cyan accents (energy/eco vibe)
- Background: Subtle grid patterns, maybe some glow effects to represent energy flow
Let me pick fonts:
- Display: "JetBrains Mono" or "Space Mono" for that technical feel
- Body: "Inter" or... actually let me avoid Inter. Maybe "IBM Plex Sans" or "Outfit"
Actually for a more distinctive look:
- Headline: "Space Grotesk" - technical but modern
- Data/Mono: "JetBrains Mono" for the metrics
Color palette:
- Background: Very dark (almost black) with subtle green tint
- Accent: Bright neon green (#00ff88)
- Secondary: Cyan/teal for contrast
- Muted: Gray tones
Features to implement:
- Animated hero with energy flow visualization (CSS particles/waves)
- Real-time telemetry panel with simulated data
- Asset optimizer section with interactive elements
- CPU budget gauge
- Carbon savings calculator
- Interactive checklist/actions
Interactions:
- Theme toggle (dark/light or maybe different energy modes)
- Scroll-triggered reveals
- Interactive charts/hover states
- Simulated real-time data updates
- Clickable action items
Let me build this as a comprehensive dashboard/landing page hybrid.
Web Carbon Footprint Reduction Program
A comprehensive sustainability dashboard featuring real-time energy telemetry, CPU budgeting, and asset optimization tools. The design uses a technical-industrial aesthetic with eco-tech accents.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GreenStack | Web Carbon Reduction Program</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Space+Grotesk:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
:root {
--bg: #0a0f0d;
--bg-elevated: #111916;
--fg: #e8f5e9;
--fg-muted: #6b8f7a;
--accent: #00ff88;
--accent-dim: #00cc6a;
--warning: #ffaa00;
--danger: #ff4757;
--cyan: #00d4aa;
--card: #151f1a;
--border: #1e3028;
--glow: rgba(0, 255, 136, 0.15);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
html { scroll-behavior: auto; }
*, *::before, *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}
body {
font-family: 'Space Grotesk', sans-serif;
background: var(--bg);
color: var(--fg);
line-height: 1.6;
overflow-x: hidden;
}
.font-mono {
font-family: 'JetBrains Mono', monospace;
}
/* Grid background */
.grid-bg {
background-image:
linear-gradient(rgba(0, 255, 136, 0.03) 1px, transparent 1px),
linear-gradient(90deg, rgba(0, 255, 136, 0.03) 1px, transparent 1px);
background-size: 60px 60px;
}
/* Glow effects */
.glow-orb {
position: absolute;
border-radius: 50%;
filter: blur(80px);
pointer-events: none;
}
.glow-green {
background: radial-gradient(circle, rgba(0, 255, 136, 0.3) 0%, transparent 70%);
}
.glow-cyan {
background: radial-gradient(circle, rgba(0, 212, 170, 0.2) 0%, transparent 70%);
}
/* Animations */
@keyframes float {
0%, 100% { transform: translateY(0) rotate(0deg); }
50% { transform: translateY(-20px) rotate(2deg); }
}
@keyframes pulse-ring {
0% { transform: scale(0.8); opacity: 1; }
100% { transform: scale(1.5); opacity: 0; }
}
@keyframes data-flow {
0% { background-position: 0% 50%; }
100% { background-position: 200% 50%; }
}
@keyframes count-up {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes slide-in-left {
from { opacity: 0; transform: translateX(-40px); }
to { opacity: 1; transform: translateX(0); }
}
@keyframes slide-in-right {
from { opacity: 0; transform: translateX(40px); }
to { opacity: 1; transform: translateX(0); }
}
@keyframes fade-up {
from { opacity: 0; transform: translateY(30px); }
to { opacity: 1; transform: translateY(0); }
}
.animate-float {
animation: float 6s ease-in-out infinite;
}
.animate-pulse-ring {
animation: pulse-ring 2s ease-out infinite;
}
.data-flow-line {
background: linear-gradient(90deg, transparent, var(--accent), transparent);
background-size: 200% 100%;
animation: data-flow 2s linear infinite;
}
/* Reveal animations */
.reveal {
opacity: 0;
transform: translateY(30px);
transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible {
opacity: 1;
transform: translateY(0);
}
.reveal-left {
opacity: 0;
transform: translateX(-40px);
transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal-left.visible {
opacity: 1;
transform: translateX(0);
}
.reveal-right {
opacity: 0;
transform: translateX(40px);
transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal-right.visible {
opacity: 1;
transform: translateX(0);
}
/* Card styles */
.card {
background: var(--card);
border: 1px solid var(--border);
border-radius: 12px;
transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.card:hover {
transform: translateY(-4px);
border-color: var(--accent);
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 0 30px var(--glow);
}
/* Button styles */
.btn-primary {
background: var(--accent);
color: var(--bg);
font-weight: 600;
padding: 14px 28px;
border-radius: 8px;
border: none;
cursor: pointer;
transition: all 0.2s ease;
position: relative;
overflow: hidden;
}
.btn-primary:hover {
background: var(--accent-dim);
transform: translateY(-2px);
box-shadow: 0 10px 30px rgba(0, 255, 136, 0.3);
}
.btn-primary:active {
transform: translateY(0);
}
.btn-primary:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 3px;
}
.btn-secondary {
background: transparent;
color: var(--fg);
font-weight: 500;
padding: 14px 28px;
border-radius: 8px;
border: 1px solid var(--border);
cursor: pointer;
transition: all 0.2s ease;
}
.btn-secondary:hover {
border-color: var(--accent);
color: var(--accent);
background: rgba(0, 255, 136, 0.05);
}
.btn-secondary:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 3px;
}
/* Progress bar */
.progress-bar {
height: 8px;
background: var(--border);
border-radius: 4px;
overflow: hidden;
}
.progress-fill {
height: 100%;
border-radius: 4px;
transition: width 1s ease;
}
/* Gauge */
.gauge-ring {
fill: none;
stroke-linecap: round;
transition: stroke-dashoffset 1s ease;
}
/* Telemetry pulse */
.telemetry-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--accent);
position: relative;
}
.telemetry-dot::before {
content: '';
position: absolute;
inset: -4px;
border-radius: 50%;
border: 2px solid var(--accent);
animation: pulse-ring 2s ease-out infinite;
}
/* Tab styles */
.tab-btn {
padding: 12px 20px;
background: transparent;
border: none;
color: var(--fg-muted);
font-weight: 500;
cursor: pointer;
position: relative;
transition: color 0.2s ease;
}
.tab-btn:hover {
color: var(--fg);
}
.tab-btn.active {
color: var(--accent);
}
.tab-btn.active::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 2px;
background: var(--accent);
}
.tab-btn:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
/* Energy visualization */
.energy-line {
stroke: var(--accent);
stroke-width: 2;
fill: none;
stroke-dasharray: 8 4;
animation: dash 20s linear infinite;
}
@keyframes dash {
to { stroke-dashoffset: -1000; }
}
/* Scrollbar */
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: var(--bg);
}
::-webkit-scrollbar-thumb {
background: var(--border);
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: var(--fg-muted);
}
/* Stat counter */
.stat-value {
font-size: clamp(2.5rem, 5vw, 4rem);
font-weight: 700;
line-height: 1;
}
</style>
</head>
<body class="grid-bg">
<!-- Navigation -->
<nav class="fixed top-0 left-0 right-0 z-50 backdrop-blur-md bg-[var(--bg)]/80 border-b border-[var(--border)]">
<div class="max-w-7xl mx-auto px-6 py-4 flex items-center justify-between">
<a href="#" class="flex items-center gap-3" aria-label="GreenStack Home">
<div class="w-10 h-10 rounded-lg bg-[var(--accent)] flex items-center justify-center">
<svg class="w-6 h-6 text-[var(--bg)]" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"/>
</svg>
</div>
<span class="font-semibold text-xl">GreenStack</span>
</a>
<div class="hidden md:flex items-center gap-8">
<a href="#telemetry" class="text-[var(--fg-muted)] hover:text-[var(--fg)] transition-colors">Telemetry</a>
<a href="#assets" class="text-[var(--fg-muted)] hover:text-[var(--fg)] transition-colors">Assets</a>
<a href="#cpu" class="text-[var(--fg-muted)] hover:text-[var(--fg)] transition-colors">CPU Budget</a>
<a href="#impact" class="text-[var(--fg-muted)] hover:text-[var(--fg)] transition-colors">Impact</a>
</div>
<button id="energyMode" class="btn-secondary text-sm px-4 py-2 flex items-center gap-2" aria-label="Toggle energy mode">
<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z"/>
</svg>
<span class="hidden sm:inline">Eco Mode</span>
</button>
</div>
</nav>
<!-- Hero Section -->
<section class="relative min-h-screen flex items-center pt-20 overflow-hidden">
<!-- Background orbs -->
<div class="glow-orb glow-green w-96 h-96 -top-48 -right-48 animate-float"></div>
<div class="glow-orb glow-cyan w-64 h-64 bottom-20 -left-32" style="animation: float 8s ease-in-out infinite reverse;"></div>
<div class="max-w-7xl mx-auto px-6 py-20 grid lg:grid-cols-2 gap-16 items-center relative z-10">
<div class="reveal-left" data-delay="0">
<div class="inline-flex items-center gap-2 px-4 py-2 rounded-full bg-[var(--card)] border border-[var(--border)] mb-6">
<span class="telemetry-dot"></span>
<span class="text-sm font-mono text-[var(--accent)]">LIVE MONITORING</span>
</div>
<h1 class="text-4xl sm:text-5xl lg:text-6xl font-bold leading-tight mb-6">
Measure. Optimize.
<span class="text-[var(--accent)]">Decarbonize.</span>
</h1>
<p class="text-lg text-[var(--fg-muted)] mb-8 max-w-xl">
A comprehensive program to reduce your web application's carbon footprint through intelligent asset optimization, CPU budgeting, and real-time browser energy telemetry.
</p>
<div class="flex flex-wrap gap-4">
<button class="btn-primary">Start Monitoring</button>
<button class="btn-secondary">View Documentation</button>
</div>
<div class="mt-12 pt-8 border-t border-[var(--border)] grid grid-cols-3 gap-8">
<div>
<div class="stat-value font-mono text-[var(--accent)]" data-target="2.4">0</div>
<div class="text-sm text-[var(--fg-muted)] mt-1">GB CO₂ saved/hr</div>
</div>
<div>
<div class="stat-value font-mono text-[var(--cyan)]" data-target="47">0</div>
<div class="text-sm text-[var(--fg-muted)] mt-1">% faster loads</div>
</div>
<div>
<div class="stat-value font-mono text-[var(--warning)]" data-target="12K">0</div>
<div class="text-sm text-[var(--fg-muted)] mt-1">Sites monitored</div>
</div>
</div>
</div>
<!-- Hero visualization -->
<div class="reveal-right relative" data-delay="200">
<div class="relative aspect-square max-w-lg mx-auto">
<!-- Energy flow SVG -->
<svg class="absolute inset-0 w-full h-full" viewBox="0 0 400 400" aria-hidden="true">
<circle cx="200" cy="200" r="180" class="energy-line" opacity="0.3"/>
<circle cx="200" cy="200" r="140" class="energy-line" opacity="0.5"/>
<circle cx="200" cy="200" r="100" class="energy-line" opacity="0.7"/>
</svg>
<!-- Center dashboard preview -->
<div class="absolute inset-0 flex items-center justify-center">
<div class="w-64 h-64 rounded-2xl bg-[var(--card)] border border-[var(--border)] p-6 backdrop-blur-sm">
<div class="flex items-center justify-between mb-4">
<span class="text-xs font-mono text-[var(--fg-muted)]">ENERGY INDEX</span>
<span class="w-2 h-2 rounded-full bg-[var(--accent)]"></span>
</div>
<div class="text-center my-6">
<div class="text-5xl font-bold font-mono text-[var(--accent)]" id="heroEnergyIndex">87</div>
<div class="text-sm text-[var(--fg-muted)] mt-1">/ 100 score</div>
</div>
<div class="space-y-3">
<div class="flex justify-between text-xs">
<span class="text-[var(--fg-muted)]">Assets</span>
<span class="text-[var(--accent)]">92%</span>
</div>
<div class="progress-bar">
<div class="progress-fill bg-[var(--accent)]" style="width: 92%"></div>
</div>
<div class="flex justify-between text-xs">
<span class="text-[var(--fg-muted)]">CPU Budget</span>
<span class="text-[var(--cyan)]">78%</span>
</div>
<div class="progress-bar">
<div class="progress-fill bg-[var(--cyan)]" style="width: 78%"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Scroll indicator -->
<div class="absolute bottom-8 left-1/2 -translate-x-1/2 flex flex-col items-center gap-2 text-[var(--fg-muted)]">
<span class="text-xs font-mono">SCROLL TO EXPLORE</span>
<svg class="w-5 h-5 animate-bounce" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 5v14M5 12l7 7 7-7"/>
</svg>
</div>
</section>
<!-- Real-time Telemetry Section -->
<section id="telemetry" class="py-24 relative">
<div class="max-w-7xl mx-auto px-6">
<div class="text-center mb-16 reveal">
<span class="inline-block px-4 py-1 rounded-full bg-[var(--accent)]/10 text-[var(--accent)] text-sm font-mono mb-4">TELEMETRY</span>
<h2 class="text-3xl sm:text-4xl font-bold mb-4">Real-Time Browser Energy Monitoring</h2>
<p class="text-[var(--fg-muted)] max-w-2xl mx-auto">Track energy consumption metrics directly from the browser with millisecond precision.</p>
</div>
<div class="grid lg:grid-cols-3 gap-6">
<!-- Main telemetry panel -->
<div class="lg:col-span-2 card p-6 reveal" data-delay="100">
<div class="flex items-center justify-between mb-6">
<h3 class="font-semibold">Live Energy Metrics</h3>
<div class="flex items-center gap-2">
<span class="telemetry-dot"></span>
<span class="text-xs font-mono text-[var(--accent)]">STREAMING</span>
</div>
</div>
<!-- Tabs -->
<div class="flex border-b border-[var(--border)] mb-6 overflow-x-auto" role="tablist">
<button class="tab-btn active" role="tab" aria-selected="true" data-tab="overview">Overview</button>
<button class="tab-btn" role="tab" aria-selected="false" data-tab="memory">Memory</button>
<button class="tab-btn" role="tab" aria-selected="false" data-tab="network">Network</button>
<button class="tab-btn" role="tab" aria-selected="false" data-tab="cpu">CPU</button>
</div>
<!-- Tab content -->
<div id="tab-overview" class="tab-content">
<div class="grid sm:grid-cols-2 gap-4 mb-6">
<div class="bg-[var(--bg)] rounded-lg p-4">
<div class="flex items-center gap-2 mb-2">
<svg class="w-4 h-4 text-[var(--accent)]" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z"/>
</svg>
<span class="text-xs font-mono text-[var(--fg-muted)]">POWER DRAW</span>
</div>
<div class="text-2xl font-bold font-mono" id="powerDraw">12.4</div>
<div class="text-xs text-[var(--fg-muted)]">Watts estimated</div>
</div>
<div class="bg-[var(--bg)] rounded-lg p-4">
<div class="flex items-center gap-2 mb-2">
<svg class="w-4 h-4 text-[var(--cyan)]" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10"/>
<path d="M12 6v6l4 2"/>
</svg>
<span class="text-xs font-mono text-[var(--fg-muted)]">SESSION DURATION</span>
</div>
<div class="text-2xl font-bold font-mono" id="sessionDuration">00:00:00</div>
<div class="text-xs text-[var(--fg-muted)]">Active monitoring</div>
</div>
</div>
<!-- Mini chart -->
<div class="bg-[var(--bg)] rounded-lg p-4">
<div class="flex justify-between items-center mb-4">
<span class="text-xs font-mono text-[var(--fg-muted)]">ENERGY WAVEFORM</span>
<span class="text-xs text-[var(--accent)]">Last 60s</span>
</div>
<div class="h-32 flex items-end gap-1" id="waveform" aria-label="Energy waveform chart">
<!-- Bars generated by JS -->
</div>
</div>
</div>
<div id="tab-memory" class="tab-content hidden">
<div class="space-y-4">
<div class="bg-[var(--bg)] rounded-lg p-4">
<div class="flex justify-between mb-2">
<span class="text-sm">Heap Used</span>
<span class="font-mono text-[var(--accent)]" id="heapUsed">24.2 MB</span>
</div>
<div class="progress-bar">
<div class="progress-fill bg-[var(--accent)]" id="heapBar" style="width: 35%"></div>
</div>
</div>
<div class="bg-[var(--bg)] rounded-lg p-4">
<div class="flex justify-between mb-2">
<span class="text-sm">DOM Nodes</span>
<span class="font-mono text-[var(--cyan)]" id="domNodes">1,247</span>
</div>
<div class="progress-bar">
<div class="progress-fill bg-[var(--cyan)]" style="width: 25%"></div>
</div>
</div>
<div class="bg-[var(--bg)] rounded-lg p-4">
<div class="flex justify-between mb-2">
<span class="text-sm">Event Listeners</span>
<span class="font-mono text-[var(--warning)]" id="eventListeners">89</span>
</div>
<div class="progress-bar">
<div class="progress-fill bg-[var(--warning)]" style="width: 18%"></div>
</div>
</div>
</div>
</div>
<div id="tab-network" class="tab-content hidden">
<div class="space-y-4">
<div class="bg-[var(--bg)] rounded-lg p-4 flex justify-between items-center">
<div>
<div class="text-sm text-[var(--fg-muted)]">Total Transferred</div>
<div class="text-xl font-bold font-mono">2.4 MB</div>
</div>
<div class="text-right">
<div class="text-sm text-[var(--fg-muted)]">Requests</div>
<div class="text-xl font-bold font-mono text-[var(--accent)]">34</div>
</div>
</div>
<div class="bg-[var(--bg)] rounded-lg p-4 flex justify-between items-center">
<div>
<div class="text-sm text-[var(--fg-muted)]">Cached Resources</div>
<div class="text-xl font-bold font-mono">18</div>
</div>
<div class="text-right">
<div class="text-sm text-[var(--fg-muted)]">Cache Hit Rate</div>
<div class="text-xl font-bold font-mono text-[var(--cyan)]">67%</div>
</div>
</div>
</div>
</div>
<div id="tab-cpu" class="tab-content hidden">
<div class="space-y-4">
<div class="bg-[var(--bg)] rounded-lg p-4">
<div class="flex justify-between mb-2">
<span class="text-sm">Main Thread Utilization</span>
<span class="font-mono text-[var(--accent)]">24%</span>
</div>
<div class="progress-bar">
<div class="progress-fill bg-[var(--accent)]" style="width: 24%"></div>
</div>
</div>
<div class="bg-[var(--bg)] rounded-lg p-4">
<div class="flex justify-between mb-2">
<span class="text-sm">Long Tasks (>50ms)</span>
<span class="font-mono text-[var(--warning)]">3</span>
</div>
<div class="progress-bar">
<div class="progress-fill bg-[var(--warning)]" style="width: 12%"></div>
</div>
</div>
</div>
</div>
</div>
<!-- Side panel -->
<div class="space-y-6">
<div class="card p-6 reveal" data-delay="200">
<h3 class="font-semibold mb-4">Carbon Intensity</h3>
<div class="relative w-40 h-40 mx-auto">
<svg class="w-full h-full -rotate-90" viewBox="0 0 100 100" aria-label="Carbon intensity gauge showing 68%">
<circle cx="50" cy="50" r="42" fill="none" stroke="var(--border)" stroke-width="8"/>
<circle cx="50" cy="50" r="42" class="gauge-ring" stroke="var(--accent)" stroke-width="8"
stroke-dasharray="264" stroke-dashoffset="85"/>
</svg>
<div class="absolute inset-0 flex flex-col items-center justify-center">
<span class="text-3xl font-bold font-mono" id="carbonGauge">68</span>
<span class="text-xs text-[var(--fg-muted)]">g CO₂/kWh</span>
</div>
</div>
<div class="mt-4 text-center text-sm text-[var(--fg-muted)]">
Grid: <span class="text-[var(--accent)]">Renewable Mix</span>
</div>
</div>
<div class="card p-6 reveal" data-delay="300">
<h3 class="font-semibold mb-4">Recommendations</h3>
<ul class="space-y-3 text-sm">
<li class="flex items-start gap-2">
<svg class="w-5 h-5 text-[var(--accent)] flex-shrink-0 mt-0.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M20 6L9 17l-5-5"/>
</svg>
<span>Enable lazy loading for offscreen images</span>
</li>
<li class="flex items-start gap-2">
<svg class="w-5 h-5 text-[var(--warning)] flex-shrink-0 mt-0.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 9v4M12 17h.01"/>
<path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/>
</svg>
<span>Reduce unused JavaScript by 23KB</span>
</li>
<li class="flex items-start gap-2">
<svg class="w-5 h-5 text-[var(--fg-muted)] flex-shrink-0 mt-0.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10"/>
<path d="M12 6v6l4 2"/>
</svg>
<span>Consider WebP format for 8 images</span>
</li>
</ul>
</div>
</div>
</div>
</div>
</section>
<!-- Asset Optimization Section -->
<section id="assets" class="py-24 bg-[var(--bg-elevated)] relative overflow-hidden">
<div class="glow-orb glow-cyan w-96 h-96 -bottom-48 -right-48 opacity-50"></div>
<div class="max-w-7xl mx-auto px-6 relative z-10">
<div class="grid lg:grid-cols-2 gap-16 items-center">
<div class="reveal-left">
<span class="inline-block px-4 py-1 rounded-full bg-[var(--cyan)]/10 text-[var(--cyan)] text-sm font-mono mb-4">ASSET OPTIMIZATION</span>
<h2 class="text-3xl sm:text-4xl font-bold mb-6">Intelligent Resource Management</h2>
<p class="text-[var(--fg-muted)] mb-8">
Automatically analyze and optimize your web assets. Our engine identifies inefficiencies and provides actionable recommendations for reducing transfer size and processing time.
</p>
<div class="space-y-4">
<div class="card p-4">
<div class="flex items-center justify-between mb-2">
<div class="flex items-center gap-3">
<div class="w-10 h-10 rounded-lg bg-[var(--accent)]/10 flex items-center justify-center">
<svg class="w-5 h-5 text-[var(--accent)]" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="3" width="18" height="18" rx="2"/>
<circle cx="8.5" cy="8.5" r="1.5"/>
<path d="M21 15l-5-5L5 21"/>
</svg>
</div>
<div>
<div class="font-medium">Image Optimization</div>
<div class="text-xs text-[var(--fg-muted)]">WebP/AVIF conversion, lazy loading</div>
</div>
</div>
<span class="text-[var(--accent)] font-mono text-sm">-67%</span>
</div>
</div>
<div class="card p-4">
<div class="flex items-center justify-between mb-2">
<div class="flex items-center gap-3">
<div class="w-10 h-10 rounded-lg bg-[var(--cyan)]/10 flex items-center justify-center">
<svg class="w-5 h-5 text-[var(--cyan)]" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14.7 6.3a1 1 0 000 1.4l1.6 1.6a1 1 0 001.4 0l3.77-3.77a6 6 0 01-7.94 7.94l-6.91 6.91a2.12 2.12 0 01-3-3l6.91-6.91a6 6 0 017.94-7.94l-3.76 3.76z"/>
</svg>
</div>
<div>
<div class="font-medium">JavaScript Treeshaking</div>
<div class="text-xs text-[var(--fg-muted)]">Dead code elimination, code splitting</div>
</div>
</div>
<span class="text-[var(--cyan)] font-mono text-sm">-43%</span>
</div>
</div>
<div class="card p-4">
<div class="flex items-center justify-between mb-2">
<div class="flex items-center gap-3">
<div class="w-10 h-10 rounded-lg bg-[var(--warning)]/10 flex items-center justify-center">
<svg class="w-5 h-5 text-[var(--warning)]" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M4 19.5A2.5 2.5 0 016.5 17H20"/>
<path d="M6.5 2H20v20H6.5A2.5 2.5 0 014 19.5v-15A2.5 2.5 0 016.5 2z"/>
</svg>
</div>
<div>
<div class="font-medium">Font Subsetting</div>
<div class="text-xs text-[var(--fg-muted)]">Glyph pruning, WOFF2 compression</div>
</div>
</div>
<span class="text-[var(--warning)] font-mono text-sm">-82%</span>
</div>
</div>
</div>
</div>
<!-- Asset analyzer -->
<div class="reveal-right">
<div class="card p-6">
<div class="flex items-center justify-between mb-6">
<h3 class="font-semibold">Asset Analyzer</h3>
<button id="runAnalyzer" class="btn-primary text-sm px-4 py-2">Run Analysis</button>
</div>
<div id="analyzerResults" class="space-y-4">
<div class="text-center py-8 text-[var(--fg-muted)]">
<svg class="w-12 h-12 mx-auto mb-3 opacity-50" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<circle cx="11" cy="11" r="8"/>
<path d="M21 21l-4.35-4.35"/>
</svg>
<p>Click "Run Analysis" to scan assets</p>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- CPU Budget Section -->
<section id="cpu" class="py-24 relative">
<div class="max-w-7xl mx-auto px-6">
<div class="text-center mb-16 reveal">
<span class="inline-block px-4 py-1 rounded-full bg-[var(--warning)]/10 text-[var(--warning)] text-sm font-mono mb-4">CPU BUDGET</span>
<h2 class="text-3xl sm:text-4xl font-bold mb-4">Performance Budget Enforcement</h2>
<p class="text-[var(--fg-muted)] max-w-2xl mx-auto">Set and enforce CPU budgets to prevent performance regressions and minimize energy consumption.</p>
</div>
<div class="grid md:grid-cols-2 lg:grid-cols-3 gap-6">
<!-- Budget card 1 -->
<div class="card p-6 reveal" data-delay="0">
<div class="flex items-center justify-between mb-4">
<span class="text-sm font-mono text-[var(--fg-muted)]">MAIN THREAD</span>
<span class="px-2 py-1 rounded bg-[var(--accent)]/10 text-[var(--accent)] text-xs">HEALTHY</span>
</div>
<div class="text-4xl font-bold font-mono mb-2">24<span class="text-lg text-[var(--fg-muted)]">ms</span></div>
<div class="text-sm text-[var(--fg-muted)] mb-4">Budget: 100ms</div>
<div class="progress-bar">
<div class="progress-fill bg-[var(--accent)]" style="width: 24%"></div>
</div>
</div>
<!-- Budget card 2 -->
<div class="card p-6 reveal" data-delay="100">
<div class="flex items-center justify-between mb-4">
<span class="text-sm font-mono text-[var(--fg-muted)]">SCRIPT EXECUTION</span>
<span class="px-2 py-1 rounded bg-[var(--warning)]/10 text-[var(--warning)] text-xs">WARNING</span>
</div>
<div class="text-4xl font-bold font-mono mb-2">340<span class="text-lg text-[var(--fg-muted)]">ms</span></div>
<div class="text-sm text-[var(--fg-muted)] mb-4">Budget: 400ms</div>
<div class="progress-bar">
<div class="progress-fill bg-[var(--warning)]" style="width: 85%"></div>
</div>
</div>
<!-- Budget card 3 -->
<div class="card p-6 reveal" data-delay="200">
<div class="flex items-center justify-between mb-4">
<span class="text-sm font-mono text-[var(--fg-muted)]">LAYOUT SHIFTS</span>
<span class="px-2 py-1 rounded bg-[var(--accent)]/10 text-[var(--accent)] text-xs">HEALTHY</span>
</div>
<div class="text-4xl font-bold font-mono mb-2">0.02<span class="text-lg text-[var(--fg-muted)]">CLS</span></div>
<div class="text-sm text-[var(--fg-muted)] mb-4">Budget: 0.1</div>
<div class="progress-bar">
<div class="progress-fill bg-[var(--accent)]" style="width: 20%"></div>
</div>
</div>
<!-- Budget card 4 -->
<div class="card p-6 reveal" data-delay="300">
<div class="flex items-center justify-between mb-4">
<span class="text-sm font-mono text-[var(--fg-muted)]">PAINT TIME</span>
<span class="px-2 py-1 rounded bg-[var(--accent)]/10 text-[var(--accent)] text-xs">HEALTHY</span>
</div>
<div class="text-4xl font-bold font-mono mb-2">1.2<span class="text-lg text-[var(--fg-muted)]">s</span></div>
<div class="text-sm text-[var(--fg-muted)] mb-4">Budget: 2.5s</div>
<div class="progress-bar">
<div class="progress-fill bg-[var(--accent)]" style="width: 48%"></div>
</div>
</div>
<!-- Budget card 5 -->
<div class="card p-6 reveal" data-delay="400">
<div class="flex items-center justify-between mb-4">
<span class="text-sm font-mono text-[var(--fg-muted)]">MEMORY HEAP</span>
<span class="px-2 py-1 rounded bg-[var(--accent)]/10 text-[var(--accent)] text-xs">HEALTHY</span>
</div>
<div class="text-4xl font-bold font-mono mb-2">42<span class="text-lg text-[var(--fg-muted)]">MB</span></div>
<div class="text-sm text-[var(--fg-muted)] mb-4">Budget: 100MB</div>
<div class="progress-bar">
<div class="progress-fill bg-[var(--accent)]" style="width: 42%"></div>
</div>
</div>
<!-- Budget card 6 -->
<div class="card p-6 reveal" data-delay="500">
<div class="flex items-center justify-between mb-4">
<span class="text-sm font-mono text-[var(--fg-muted)]">NETWORK REQUESTS</span>
<span class="px-2 py-1 rounded bg-[var(--danger)]/10 text-[var(--danger)] text-xs">OVER BUDGET</span>
</div>
<div class="text-4xl font-bold font-mono mb-2">87<span class="text-lg text-[var(--fg-muted)]">req</span></div>
<div class="text-sm text-[var(--fg-muted)] mb-4">Budget: 50req</div>
<div class="progress-bar">
<div class="progress-fill bg-[var(--danger)]" style="width: 100%"></div>
</div>
</div>
</div>
<!-- Budget configurator -->
<div class="mt-12 card p-6 reveal">
<h3 class="font-semibold mb-6">Budget Configurator</h3>
<div class="grid sm:grid-cols-2 lg:grid-cols-4 gap-6">
<div>
<label class="block text-sm text-[var(--fg-muted)] mb-2">CPU Time Budget (ms)</label>
<input type="number" value="100" class="w-full bg-[var(--bg)] border border-[var(--border)] rounded-lg px-4 py-3 font-mono focus:outline-none focus:border-[var(--accent)]" aria-label="CPU time budget in milliseconds">
</div>
<div>
<label class="block text-sm text-[var(--fg-muted)] mb-2">Memory Budget (MB)</label>
<input type="number" value="100" class="w-full bg-[var(--bg)] border border-[var(--border)] rounded-lg px-4 py-3 font-mono focus:outline-none focus:border-[var(--accent)]" aria-label="Memory budget in megabytes">
</div>
<div>
<label class="block text-sm text-[var(--fg-muted)] mb-2">Request Budget</label>
<input type="number" value="50" class="w-full bg-[var(--bg)] border border-[var(--border)] rounded-lg px-4 py-3 font-mono focus:outline-none focus:border-[var(--accent)]" aria-label="Network request budget">
</div>
<div>
<label class="block text-sm text-[var(--fg-muted)] mb-2">Alert Threshold (%)</label>
<input type="number" value="80" class="w-full bg-[var(--bg)] border border-[var(--border)] rounded-lg px-4 py-3 font-mono focus:outline-none focus:border-[var(--accent)]" aria-label="Alert threshold percentage">
</div>
</div>
<div class="mt-6 flex gap-4">
<button class="btn-primary">Save Budgets</button>
<button class="btn-secondary">Export Config</button>
</div>
</div>
</div>
</section>
<!-- Impact Section -->
<section id="impact" class="py-24 bg-[var(--bg-elevated)] relative overflow-hidden">
<div class="glow-orb glow-green w-96 h-96 top-0 left-1/4 opacity-30"></div>
<div class="max-w-7xl mx-auto px-6 relative z-10">
<div class="text-center mb-16 reveal">
<span class="inline-block px-4 py-1 rounded-full bg-[var(--accent)]/10 text-[var(--accent)] text-sm font-mono mb-4">ENVIRONMENTAL IMPACT</span>
<h2 class="text-3xl sm:text-4xl font-bold mb-4">Your Carbon Savings</h2>
<p class="text-[var(--fg-muted)] max-w-2xl mx-auto">See the real-world environmental impact of your optimization efforts.</p>
</div>
<div class="grid md:grid-cols-2 gap-8 mb-12">
<!-- Carbon calculator -->
<div class="card p-8 reveal-left">
<h3 class="text-xl font-semibold mb-6">Carbon Calculator</h3>
<div class="space-y-6">
<div>
<label class="block text-sm text-[var(--fg-muted)] mb-2">Monthly Page Views</label>
<input type="text" id="pageViews" value="1,000,000" class="w-full bg-[var(--bg)] border border-[var(--border)] rounded-lg px-4 py-3 font-mono focus:outline-none focus:border-[var(--accent)]" aria-label="Monthly page views">
</div>
<div>
<label class="block text-sm text-[var(--fg-muted)] mb-2">Average Page Weight (KB)</label>
<input type="text" id="pageWeight" value="2,400" class="w-full bg-[var(--bg)] border border-[var(--border)] rounded-lg px-4 py-3 font-mono focus:outline-none focus:border-[var(--accent)]" aria-label="Average page weight in kilobytes">
</div>
<div>
<label class="block text-sm text-[var(--fg-muted)] mb-2">Optimization Reduction (%)</label>
<input type="range" id="reduction" min="0" max="80" value="45" class="w-full accent-[var(--accent)]" aria-label="Optimization reduction percentage">
<div class="flex justify-between text-xs text-[var(--fg-muted)] mt-1">
<span>0%</span>
<span class="text-[var(--accent)] font-mono" id="reductionValue">45%</span>
<span>80%</span>
</div>
</div>
<button id="calculateBtn" class="btn-primary w-full">Calculate Impact</button>
</div>
</div>
<!-- Results -->
<div class="card p-8 reveal-right">
<h3 class="text-xl font-semibold mb-6">Estimated Savings</h3>
<div class="space-y-6" id="savingsResults">
<div class="bg-[var(--bg)] rounded-lg p-4 text-center">
<div class="text-4xl font-bold font-mono text-[var(--accent)]" id="co2Saved">216</div>
<div class="text-sm text-[var(--fg-muted)]">kg CO₂ per month</div>
</div>
<div class="grid grid-cols-2 gap-4">
<div class="bg-[var(--bg)] rounded-lg p-4 text-center">
<div class="text-2xl font-bold font-mono text-[var(--cyan)]" id="treesEquiv">10</div>
<div class="text-xs text-[var(--fg-muted)]">Trees equiv. monthly</div>
</div>
<div class="bg-[var(--bg)] rounded-lg p-4 text-center">
<div class="text-2xl font-bold font-mono text-[var(--warning)]" id="carMiles">540</div>
<div class="text-xs text-[var(--fg-muted)]">Car miles saved</div>
</div>
</div>
<div class="bg-[var(--bg)] rounded-lg p-4">
<div class="flex justify-between items-center mb-2">
<span class="text-sm text-[var(--fg-muted)]">Energy Saved</span>
<span class="font-mono text-[var(--accent)]" id="energySaved">432 kWh</span>
</div>
<div class="progress-bar">
<div class="progress-fill bg-[var(--accent)]" id="energyBar" style="width: 45%"></div>
</div>
</div>
</div>
</div>
</div>
<!-- Action checklist -->
<div class="card p-8 reveal">
<h3 class="text-xl font-semibold mb-6">Optimization Checklist</h3>
<div class="grid sm:grid-cols-2 lg:grid-cols-3 gap-4" id="checklist">
<!-- Items generated by JS -->
</div>
<div class="mt-6 pt-6 border-t border-[var(--border)] flex items-center justify-between">
<div>
<span class="text-[var(--fg-muted)]">Progress:</span>
<span class="font-mono text-[var(--accent)] ml-2" id="checklistProgress">0/12</span>
</div>
<button id="resetChecklist" class="btn-secondary text-sm px-4 py-2">Reset</button>
</div>
</div>
</div>
</section>
<!-- Footer -->
<footer class="py-12 border-t border-[var(--border)]">
<div class="max-w-7xl mx-auto px-6">
<div class="flex flex-col md:flex-row items-center justify-between gap-6">
<div class="flex items-center gap-3">
<div class="w-10 h-10 rounded-lg bg-[var(--accent)] flex items-center justify-center">
<svg class="w-6 h-6 text-[var(--bg)]" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"/>
</svg>
</div>
<span class="font-semibold text-xl">GreenStack</span>
</div>
<div class="text-sm text-[var(--fg-muted)]">
Built with sustainability in mind. <span class="text-[var(--accent)]">Carbon-neutral hosting</span>.
</div>
<div class="flex items-center gap-4">
<a href="#" class="text-[var(--fg-muted)] hover:text-[var(--accent)] transition-colors" aria-label="GitHub">
<svg class="w-5 h-5" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"/>
</svg>
</a>
<a href="#" class="text-[var(--fg-muted)] hover:text-[var(--accent)] transition-colors" aria-label="Twitter">
<svg class="w-5 h-5" viewBox="0 0 24 24" fill="currentColor">
<path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/>
</svg>
</a>
</div>
</div>
</div>
</footer>
<script>
// Data
const checklistData = [
{ id: 1, text: "Enable Gzip/Brotli compression", category: "Server" },
{ id: 2, text: "Implement lazy loading for images", category: "Assets" },
{ id: 3, text: "Use modern image formats (WebP/AVIF)", category: "Assets" },
{ id: 4, text: "Minimize main thread work", category: "CPU" },
{ id: 5, text: "Remove unused JavaScript", category: "CPU" },
{ id: 6, text: "Enable browser caching", category: "Network" },
{ id: 7, text: "Use CDN for static assets", category: "Network" },
{ id: 8, text: "Implement code splitting", category: "CPU" },
{ id: 9, text: "Optimize web fonts", category: "Assets" },
{ id: 10, text: "Reduce third-party scripts", category: "CPU" },
{ id: 11, text: "Enable HTTP/2 or HTTP/3", category: "Network" },
{ id: 12, text: "Implement service worker caching", category: "Network" }
];
const assetAnalysisData = [
{ type: "Images", count: 47, size: "2.4 MB", potential: "-67%", status: "warning" },
{ type: "JavaScript", count: 12, size: "890 KB", potential: "-43%", status: "success" },
{ type: "CSS", count: 8, size: "124 KB", potential: "-28%", status: "success" },
{ type: "Fonts", count: 4, size: "380 KB", potential: "-82%", status: "warning" }
];
// Initialize variables
let sessionSeconds = 0;
let sessionInterval = null;
let waveformInterval = null;
let checkedItems = new Set();
// DOM Elements
const waveformContainer = document.getElementById('waveform');
const sessionDurationEl = document.getElementById('sessionDuration');
const powerDrawEl = document.getElementById('powerDraw');
const heroEnergyIndex = document.getElementById('heroEnergyIndex');
const carbonGauge = document.getElementById('carbonGauge');
const checklistContainer = document.getElementById('checklist');
const checklistProgress = document.getElementById('checklistProgress');
// Initialize waveform
function initWaveform() {
if (!waveformContainer) return;
waveformContainer.innerHTML = '';
for (let i = 0; i < 60; i++) {
const bar = document.createElement('div');
bar.className = 'flex-1 bg-[var(--accent)] rounded-t transition-all duration-300';
bar.style.height = '20%';
waveformContainer.appendChild(bar);
}
}
// Update waveform with simulated data
function updateWaveform() {
if (!waveformContainer) return;
const bars = waveformContainer.children;
for (let i = 0; i < bars.length; i++) {
const height = 15 + Math.random() * 70;
bars[i].style.height = `${height}%`;
}
}
// Format time
function formatTime(seconds) {
const hrs = Math.floor(seconds / 3600);
const mins = Math.floor((seconds % 3600) / 60);
const secs = seconds % 60;
return `${hrs.toString().padStart(2, '0')}:${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;
}
// Update session duration
function updateSession() {
sessionSeconds++;
if (sessionDurationEl) {
sessionDurationEl.textContent = formatTime(sessionSeconds);
}
// Update power draw
if (powerDrawEl) {
const power = (10 + Math.random() * 5).toFixed(1);
powerDrawEl.textContent = power;
}
}
// Animate stat counters
function animateCounters() {
const counters = document.querySelectorAll('[data-target]');
counters.forEach(counter => {
const target = counter.dataset.target;
const isDecimal = target.includes('.');
const hasK = target.includes('K');
const numTarget = parseFloat(target);
let current = 0;
const increment = numTarget / 50;
const timer = setInterval(() => {
current += increment;
if (current >= numTarget) {
current = numTarget;
clearInterval(timer);
}
let display = isDecimal ? current.toFixed(1) : Math.floor(current);
if (hasK) display = Math.floor(current) + 'K';
counter.textContent = display;
}, 30);
});
}
// Initialize checklist
function initChecklist() {
if (!checklistContainer) return;
checklistContainer.innerHTML = '';
checklistData.forEach(item => {
const div = document.createElement('div');
div.className = `flex items-center gap-3 p-3 rounded-lg bg-[var(--bg)] cursor-pointer transition-all hover:bg-[var(--bg-elevated)] ${checkedItems.has(item.id) ? 'opacity-60' : ''}`;
div.setAttribute('role', 'checkbox');
div.setAttribute('aria-checked', checkedItems.has(item.id));
div.setAttribute('tabindex', '0');
div.innerHTML = `
<div class="w-6 h-6 rounded border-2 flex items-center justify-center transition-all ${checkedItems.has(item.id) ? 'bg-[var(--accent)] border-[var(--accent)]' : 'border-[var(--border)]'}">
${checkedItems.has(item.id) ? '<svg class="w-4 h-4 text-[var(--bg)]" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3"><path d="M20 6L9 17l-5-5"/></svg>' : ''}
</div>
<div class="flex-1">
<div class="text-sm ${checkedItems.has(item.id) ? 'line-through text-[var(--fg-muted)]' : ''}">${item.text}</div>
<div class="text-xs text-[var(--fg-muted)]">${item.category}</div>
</div>
`;
div.addEventListener('click', () => toggleChecklistItem(item.id, div));
div.addEventListener('keydown', (e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
toggleChecklistItem(item.id, div);
}
});
checklistContainer.appendChild(div);
});
updateChecklistProgress();
}
// Toggle checklist item
function toggleChecklistItem(id, element) {
if (checkedItems.has(id)) {
checkedItems.delete(id);
element.classList.remove('opacity-60');
element.querySelector('.text-sm').classList.remove('line-through', 'text-[var(--fg-muted)]');
element.setAttribute('aria-checked', 'false');
const checkbox = element.querySelector('.w-6');
checkbox.classList.remove('bg-[var(--accent)]', 'border-[var(--accent)]');
checkbox.classList.add('border-[var(--border)]');
checkbox.innerHTML = '';
} else {
checkedItems.add(id);
element.classList.add('opacity-60');
element.querySelector('.text-sm').classList.add('line-through', 'text-[var(--fg-muted)]');
element.setAttribute('aria-checked', 'true');
const checkbox = element.querySelector('.w-6');
checkbox.classList.add('bg-[var(--accent)]', 'border-[var(--accent)]');
checkbox.classList.remove('border-[var(--border)]');
checkbox.innerHTML = '<svg class="w-4 h-4 text-[var(--bg)]" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3"><path d="M20 6L9 17l-5-5"/></svg>';
}
updateChecklistProgress();
}
// Update checklist progress
function updateChecklistProgress() {
if (checklistProgress) {
checklistProgress.textContent = `${checkedItems.size}/${checklistData.length}`;
}
}
// Tab switching
function initTabs() {
const tabBtns = document.querySelectorAll('.tab-btn');
tabBtns.forEach(btn => {
btn.addEventListener('click', () => {
// Update button states
tabBtns.forEach(b => {
b.classList.remove('active');
b.setAttribute('aria-selected', 'false');
});
btn.classList.add('active');
btn.setAttribute('aria-selected', 'true');
// Show/hide content
const tabId = btn.dataset.tab;
document.querySelectorAll('.tab-content').forEach(content => {
content.classList.add('hidden');
});
const activeContent = document.getElementById(`tab-${tabId}`);
if (activeContent) {
activeContent.classList.remove('hidden');
}
});
});
}
// Scroll reveal
function initScrollReveal() {
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
const delay = entry.target.dataset.delay || 0;
setTimeout(() => {
entry.target.classList.add('visible');
}, parseInt(delay));
}
});
}, { threshold: 0.1 });
document.querySelectorAll('.reveal, .reveal-left, .reveal-right').forEach(el => {
observer.observe(el);
});
}
// Asset analyzer
function initAnalyzer() {
const runBtn = document.getElementById('runAnalyzer');
const resultsContainer = document.getElementById('analyzerResults');
if (!runBtn || !resultsContainer) return;
runBtn.addEventListener('click', () => {
runBtn.disabled = true;
runBtn.textContent = 'Analyzing...';
resultsContainer.innerHTML = `
<div class="text-center py-8">
<div class="w-12 h-12 border-4 border-[var(--accent)] border-t-transparent rounded-full animate-spin mx-auto mb-4"></div>
<p class="text-[var(--fg-muted)]">Scanning assets...</p>
</div>
`;
setTimeout(() => {
runBtn.disabled = false;
runBtn.textContent = 'Run Analysis';
resultsContainer.innerHTML = assetAnalysisData.map(asset => `
<div class="bg-[var(--bg)] rounded-lg p-4 flex items-center justify-between">
<div class="flex items-center gap-3">
<div class="w-10 h-10 rounded-lg ${asset.status === 'warning' ? 'bg-[var(--warning)]/10' : 'bg-[var(--accent)]/10'} flex items-center justify-center">
<svg class="w-5 h-5 ${asset.status === 'warning' ? 'text-[var(--warning)]' : 'text-[var(--accent)]'}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
${asset.type === 'Images' ? '<rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><path d="M21 15l-5-5L5 21"/>' :
asset.type === 'JavaScript' ? '<path d="M14.7 6.3a1 1 0 000 1.4l1.6 1.6a1 1 0 001.4 0l3.77-3.77a6 6 0 01-7.94 7.94l-6.91 6.91a2.12 2.12 0 01-3-3l6.91-6.91a6 6 0 017.94-7.94l-3.76 3.76z"/>' :
asset.type === 'CSS' ? '<path d="M4 19.5A2.5 2.5 0 016.5 17H20"/><path d="M6.5 2H20v20H6.5A2.5 2.5 0 014 19.5v-15A2.5 2.5 0 016.5 2z"/>' :
'<path d="M4 7V4h16v3M9 20h6M12 4v16"/>'}
</svg>
</div>
<div>
<div class="font-medium">${asset.type}</div>
<div class="text-xs text-[var(--fg-muted)]">${asset.count} files · ${asset.size}</div>
</div>
</div>
<span class="${asset.status === 'warning' ? 'text-[var(--warning)]' : 'text-[var(--accent)]'} font-mono text-sm">${asset.potential}</span>
</div>
`).join('');
}, 2000);
});
}
// Carbon calculator
function initCalculator() {
const reductionSlider = document.getElementById('reduction');
const reductionValue = document.getElementById('reductionValue');
const calculateBtn = document.getElementById('calculateBtn');
if (reductionSlider && reductionValue) {
reductionSlider.addEventListener('input', () => {
reductionValue.textContent = `${reductionSlider.value}%`;
});
}
if (calculateBtn) {
calculateBtn.addEventListener('click', () => {
const pageViews = parseFloat(document.getElementById('pageViews').value.replace(/,/g, '')) || 1000000;
const pageWeight = parseFloat(document.getElementById('pageWeight').value.replace(/,/g, '')) || 2400;
const reduction = parseInt(document.getElementById('reduction').value) || 45;
// Simplified carbon calculation
const bytesTransferred = pageViews * pageWeight * 1024;
const kwhPerByte = 0.000000000196; // Approximate
const energyUsed = bytesTransferred * kwhPerByte;
const energySaved = energyUsed * (reduction / 100);
const co2PerKwh = 0.5; // kg
const co2Saved = energySaved * co2PerKwh;
// Update display
document.getElementById('co2Saved').textContent = Math.round(co2Saved);
document.getElementById('treesEquiv').textContent = Math.round(co2Saved / 21.77); // 1 tree absorbs ~21.77kg CO2/year
document.getElementById('carMiles').textContent = Math.round(co2Saved / 0.4); // ~0.4kg CO2 per mile
document.getElementById('energySaved').textContent = `${Math.round(energySaved)} kWh`;
document.getElementById('energyBar').style.width = `${reduction}%`;
});
}
}
// Reset checklist
function initResetChecklist() {
const resetBtn = document.getElementById('resetChecklist');
if (resetBtn) {
resetBtn.addEventListener('click', () => {
checkedItems.clear();
initChecklist();
});
}
}
// Energy mode toggle
function initEnergyMode() {
const energyBtn = document.getElementById('energyMode');
let isEcoMode = false;
if (energyBtn) {
energyBtn.addEventListener('click', () => {
isEcoMode = !isEcoMode;
if (isEcoMode) {
document.documentElement.style.setProperty('--accent', '#00aa55');
document.documentElement.style.setProperty('--glow', 'rgba(0, 170, 85, 0.15)');
energyBtn.classList.add('border-[var(--accent)]', 'text-[var(--accent)]');
// Reduce animations
document.body.classList.add('reduce-motion');
} else {
document.documentElement.style.setProperty('--accent', '#00ff88');
document.documentElement.style.setProperty('--glow', 'rgba(0, 255, 136, 0.15)');
energyBtn.classList.remove('border-[var(--accent)]', 'text-[var(--accent)]');
document.body.classList.remove('reduce-motion');
}
});
}
}
// Simulate live data updates
function simulateLiveData() {
setInterval(() => {
// Update hero energy index
if (heroEnergyIndex) {
const newValue = 80 + Math.floor(Math.random() * 15);
heroEnergyIndex.textContent = newValue;
}
// Update carbon gauge
if (carbonGauge) {
const newValue = 60 + Math.floor(Math.random() * 30);
carbonGauge.textContent = newValue;
}
}, 5000);
}
// Initialize everything
function init() {
initWaveform();
initTabs();
initScrollReveal();
initChecklist();
initAnalyzer();
initCalculator();
initResetChecklist();
initEnergyMode();
// Start animations after a short delay
setTimeout(() => {
animateCounters();
// Start session timer
sessionInterval = setInterval(updateSession, 1000);
// Start waveform updates
waveformInterval = setInterval(updateWaveform, 2000);
// Start live data simulation
simulateLiveData();
}, 500);
}
// Check for reduced motion preference
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)');
if (prefersReducedMotion.matches) {
document.documentElement.style.setProperty('--transition-speed', '0');
}
// Start app
document.addEventListener('DOMContentLoaded', init);
</script>
</body>
</html>
Key Features
1. Real-Time Energy Telemetry
- Live energy waveform visualization
- Session duration tracking
- Power draw estimates
- Tabbed interface for Memory/Network/CPU metrics
2. Asset Optimization Analyzer
- Interactive "Run Analysis" button with loading state
- Categorized results (Images, JS, CSS, Fonts)
- Potential savings percentages with status indicators
3. CPU Budget Dashboard
- Visual budget cards with health status badges
- Configurable budget thresholds
- Progress bars showing utilization vs budget
4. Carbon Calculator
- Input page views and page weight
- Adjustable optimization reduction slider
- Real-world equivalents (trees, car miles, energy)
5. Interactive Optimization Checklist
- 12 actionable items organized by category
- Click/toggle functionality with visual feedback
- Progress tracking
Design Highlights
- Technical-industrial aesthetic with dark theme and neon green accents
- JetBrains Mono + Space Grotesk font pairing
- Layered depth with grid backgrounds, glow orbs, and glass effects
- Staggered scroll reveals and micro-interactions
- Accessible: keyboard navigation, ARIA labels, focus states
- Respects
prefers-reduced-motion