# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Project Overview Collection of interactive calculators visualizing how seemingly small differences grow exponentially over time. Norwegian-language UI. Hosted at `forskjeller.naiv.no`. ## Architecture Static site in `public/` — no build system, no package manager. Serve `public/` as the site root. Each topic gets its own subdirectory with `index.html`, `style.css`, `app.js`. ### Shared pattern (all calculators) Each calculator directory contains three files following the same pattern: - `index.html` — Header, range-slider controls, stat cards, chart canvases, explainer section - `style.css` — Identical copy across all calculators. CSS custom properties in `:root`, CSS Grid layouts, responsive breakpoints at 560px/480px/360px - `app.js` — Self-contained logic with `fmtKr()`, `fmtShort()`, `getData()`, `baseOpts()`, `update()`. Charts update with `'none'` animation mode. ### Calculators - **`public/lonn/`** — Salary gap: percentage raises amplify absolute differences. Model: `gap = (B₀ − A₀) × (1 + r)ⁿ` - **`public/sparing/`** — Compound interest: same savings, different returns. Model: `FV = P × ((1+r)^n - 1) / r` (monthly compounding). Stacked bar chart for deposits vs interest. - **`public/bolig/`** — Housing leverage: same price growth, different starting prices. 85% LTV amplifies equity gap ~6.67×. Model: `Equity = Price × (1+g)^n - Loan` - **`public/arv/`** — Inheritance gap: lump sum + equal savings, gap never closes. Model: `Gap = Arv × (1+r)^n`. Has percentage y-axis chart. **External dependencies** (loaded via CDN, no install needed): Chart.js 4.4.1, Google Fonts (Fraunces + DM Sans). ### Key Design Decisions - Color palette: Blue (#1a4a8a) = A, Red (#c0392b) = B, Purple (#4a3a8a) = gap - All charts share `baseOpts()` — modify this for consistent chart styling changes - Label pattern: "I dag" at year 0, show every 5th year, always show last year - DOM updates use `textContent` or DOM methods (not innerHTML) for security ## Development ```bash python3 -m http.server 8000 -d public # open http://localhost:8000/ for landing page # open http://localhost:8000/{lonn,sparing,bolig,arv}/ for individual calculators ``` ## Language All user-facing text is in Norwegian Bokmål (nb-NO). Use Norwegian for UI strings and `nb-NO` locale for number formatting.