forskjeller.naiv.no/CLAUDE.md
Ole-Morten Duesund 22373c250b Samle CSS i én delt fil og oppdater stempler
Flytt identisk style.css fra kalkulatorkatalogene til public/style.css
og oppdater alle index.html til å referere ../style.css.

Nye stempler: «Penger lager penger» (sparing), «Boligfesten» (bolig),
«Fødselsloteriet» (arv) + sarkastisk åpning i arv-banneret.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:54:51 +01:00

2.6 KiB
Raw Blame History

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 and app.js.

Shared CSS

public/style.css — Shared stylesheet used by all calculators (referenced as ../style.css). CSS custom properties in :root, CSS Grid layouts, responsive breakpoints at 560px/480px/360px. Calculators can add a supplementary <style> block or extra CSS file for page-specific styles if needed.

Shared pattern (all calculators)

Each calculator directory contains two files following the same pattern:

  • index.html — Header, range-slider controls, stat cards, chart canvases, explainer section. Links to ../style.css.
  • 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

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.