/* ==========================================================================
   Censible design tokens
   Source: Censible Brand System (Colour). Twelve hues normalised in OKLCH to
   one shared lightness/chroma; 500 is the core tone (L 0.72, C 0.130).
   Rule: components use the SEMANTIC tokens further down, never raw ramps.
   ========================================================================== */

:root {
  /* ---- Core spectrum ramps (100 → 900) -------------------------------- */
  --ember-100:#FFEDE8; --ember-200:#FFD7CB; --ember-300:#FFBBA6; --ember-400:#F89C80; --ember-500:#E98667; --ember-600:#BD6347; --ember-700:#94472F; --ember-800:#6A2E1B; --ember-900:#40190D;
  --coral-100:#FFEDED; --coral-200:#FFD6D6; --coral-300:#FFB9BA; --coral-400:#F9989B; --coral-500:#EB8186; --coral-600:#BF5E64; --coral-700:#954348; --coral-800:#6A2B30; --coral-900:#41171A;
  --rose-100:#FFECF2; --rose-200:#FFD4E3; --rose-300:#FEB5D1; --rose-400:#F297BB; --rose-500:#E380A9; --rose-600:#B85E84; --rose-700:#8F4364; --rose-800:#662B45; --rose-900:#3E1728;
  --orchid-100:#FDEBFC; --orchid-200:#F8D4F5; --orchid-300:#EFB9EC; --orchid-400:#E09CDD; --orchid-500:#D086CE; --orchid-600:#A764A5; --orchid-700:#814780; --orchid-800:#5C2F5B; --orchid-900:#371A36;
  --violet-100:#F2EFFF; --violet-200:#E3DCFF; --violet-300:#D1C4FF; --violet-400:#BDA8FA; --violet-500:#AB93ED; --violet-600:#8670C2; --violet-700:#665298; --violet-800:#46376D; --violet-900:#291F42;
  --sky-100:#E9F3FF; --sky-200:#CEE3FF; --sky-300:#ADD1FF; --sky-400:#85BAFF; --sky-500:#6AA7F4; --sky-600:#4A82C8; --sky-700:#31619E; --sky-800:#1D4371; --sky-900:#0E2745;
  --cerulean-100:#E3F5FF; --cerulean-200:#BFE8FF; --cerulean-300:#8FD9FF; --cerulean-400:#5FC4F5; --cerulean-500:#37B2E8; --cerulean-600:#008CBC; --cerulean-700:#00698F; --cerulean-800:#004964; --cerulean-900:#002B3D;
  --teal-100:#DDF8F9; --teal-200:#B4EEF1; --teal-300:#80E0E5; --teal-400:#41CED5; --teal-500:#00BBC3; --teal-600:#009298; --teal-700:#006E73; --teal-800:#004C50; --teal-900:#002D2F;
  --jade-100:#E1F8ED; --jade-200:#BEEED8; --jade-300:#93E1BF; --jade-400:#65CFA5; --jade-500:#3FBE90; --jade-600:#0E976D; --jade-700:#007252; --jade-800:#004F38; --jade-900:#002F1F;
  --lime-100:#ECF6E2; --lime-200:#D6E9C0; --lime-300:#BDDA99; --lime-400:#A2C672; --lime-500:#8DB456; --lime-600:#6B8E35; --lime-700:#4E6C1D; --lime-800:#344B0B; --lime-900:#1D2C04;
  --saffron-100:#F6F3DD; --saffron-200:#EAE3B7; --saffron-300:#DBD089; --saffron-400:#C9B95B; --saffron-500:#B8A636; --saffron-600:#928105; --saffron-700:#6E6100; --saffron-800:#4C4300; --saffron-900:#2D2700;
  --gold-100:#FCF0DD; --gold-200:#F6DEB6; --gold-300:#EDC889; --gold-400:#DFAF5A; --gold-500:#CF9A35; --gold-600:#A67603; --gold-700:#7E5900; --gold-800:#583D00; --gold-900:#352300;

  /* ---- Neutrals ------------------------------------------------------- */
  --stone-100:#F9F0E5; --stone-200:#E9E0D4; --stone-300:#D5CCC1; --stone-400:#BEB6AB; --stone-500:#A59D92; --stone-600:#877F75; --stone-700:#675F55; --stone-800:#484138; --stone-900:#2C251D;
  --ink-100:#F9F4F3; --ink-200:#DBD6D6; --ink-300:#AEA9A9; --ink-400:#847F7F; --ink-500:#5E5959; --ink-600:#433E3E; --ink-700:#312D2C; --ink-800:#231F1F; --ink-900:#191515;

  /* ---- The 2026 brand (DESIGN.md, the site's tokens; the app redesign, 25 November 2026) ---------------------
     Fixed in both themes. Electric is the accent and the place in charts; Racing green is the primary action and
     almost nothing else; Navy is headings, benchmarks and dark chips; Mint, Citron and Lilac are brand panels and
     tags, never text on white (under 3:1), so their text is navy. */
  --navy: #1E2742; --night: #0E1220; --electric: #3B5BF2; --racing: #004225;
  --mint: #8FE3B8; --citron: #E2D86A; --lilac: #D9BEF5; --sage: #5E9C86; --sky: #4A90D9;
  --periwinkle: #8EA0FA;            /* electric lifted for dark mode */
  --stone: #B9B2A8;                 /* the comparison's bar beside the place's (DESIGN.md's Stone 500) */
  --rust: #94472F; --verdigris: var(--sage); --mist: #F7F8FA;   /* older names, kept for the rules that use them */
  /* solid fills that stay the same in both themes, with the ink that reads on them: site markers' middle and
     bottom thirds */
  --pin-middle: #BCC8FB; --on-pin-middle: var(--navy);
  --on-lilac: var(--navy);

  /* the accent headline tile: Navy with white on it, in both themes */
  --kpi-accent: var(--navy); --kpi-accent-text: #FFFFFF;
  --kpi-accent-text-2: color-mix(in srgb, #FFFFFF 80%, transparent);
  --kpi-accent-line: color-mix(in srgb, #FFFFFF 18%, transparent);

  /* ---- Type ----------------------------------------------------------- */
  --font-sans: 'Onest', 'Helvetica Neue', system-ui, sans-serif;
  --font-mono: 'PT Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  /* ---- Shape & spacing ------------------------------------------------ */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 20px;
  --gap: 16px;
  --sidebar-w: 248px;
}

/* ==========================================================================
   Semantic tokens — DARK (the default until boot.js reads the theme)
   The 2026 design's dark mode (DESIGN.md): a night page, panels a step lighter,
   Mint primary buttons with night text, periwinkle for the accent and the place.
   Designed, not inverted: brand panels keep their colours.
   ========================================================================== */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E1220;                   /* the page (night) */
  --card: #161C2E;                 /* panels, cards, inputs */
  --sunken: #121827;               /* the sidebar, side columns */
  --subtle: #121827;               /* table headers, quiet wells */
  --quiet: #1F2639;                /* grey chips, bar tracks */
  --hover: color-mix(in srgb, #FFFFFF 5%, transparent);   /* row, nav and outline-button hover */
  --line: #283048;                 /* borders, dividers, the rails */
  --line-soft: #20273B;            /* rows inside a table */
  --line-strong: #343D58;          /* control borders */
  --axis: #4D5670;                 /* chart baselines, control hover */
  --dash: #3A4360;                 /* dashed outlines */
  --text: #EDEFF5;                 /* headings, figures */
  --text-2: #A3ABC2;               /* body copy */
  --muted: #929AB2;                /* labels, captions, sources */
  --faint: #687089;                /* placeholders, disabled */
  --outline: #EDEFF5;              /* an outline button's border */
  --code-bg: color-mix(in srgb, var(--mint) 16%, transparent);   /* tool names, metric ids */
  --code-text: var(--mint);

  --accent: var(--mint);              /* the primary button */
  --accent-hover: #A9EAC8;
  --accent-text: var(--periwinkle);   /* links, eyebrows, a highlighted figure */
  --on-accent: var(--night);          /* text on the primary button */
  --link-hover: #B5C1FC;
  --focus-line: var(--periwinkle);    /* a focused input's border */
  --mark: var(--mint);                /* the section label's square: Racing green can't be seen on night */

  /* Picked out: the nav's page (a tint), an option chosen (inverted), hovering a control */
  --selected-bg: color-mix(in srgb, var(--periwinkle) 16%, transparent);
  --selected-text: var(--text);
  --pressed-bg: #EDEFF5;
  --pressed-text: var(--night);
  --pressed-line: #EDEFF5;
  --hover-tint: color-mix(in srgb, var(--periwinkle) 8%, transparent);
  --dash-accent: color-mix(in srgb, var(--periwinkle) 35%, transparent);
  /* Tags and status labels: neutral (the consistency pass, 26 November 2026: muted text, a 1px outline; colour only in
     a provenance dot) */
  --tag-bg: transparent;
  --tag-text: var(--muted);
  --tag-line: var(--line-strong);
  --panel-tint: var(--subtle);
  /* The row picked out (the place, the row on the map): the place's own tint */
  --highlight: var(--area-1-tint);
  --highlight-hover: color-mix(in srgb, var(--periwinkle) 8%, transparent);
  --highlight-text: var(--text);
  --warn: #DFAF5A;                 /* amber: "worth a look", and nothing else */
  --warn-tint: color-mix(in srgb, #DFAF5A 14%, transparent);
  --warn-text: #E9C47F;            /* amber words on --warn-tint: a cost, a near miss's failing figure, a tip */
  /* Dark chips: the question you asked, toasts, the send button, a map label */
  --contrast-bg: #2A3355;
  --contrast-hover: #343F66;
  --contrast-text: #FFFFFF;
  /* the wordmark: navy on light, white on dark, and nothing else (DESIGN.md) */
  --logo: #FFFFFF;
  /* floating layers only (menus, drop-downs, toasts): DESIGN.md's card shadow, black in dark */
  --pop-shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .5);

  /* Data: the place in periwinkle, a compared place in Ember, a third in Citron; benchmarks a light line */
  --area-1: var(--periwinkle);
  --area-2: #F89C80;
  --avatar-bg: var(--rose-400);        /* the sidebar's initial, by your name */
  --avatar-text: var(--night);
  --off-text: var(--ember-300);             /* a figure well off the starting place (Find's table) */
  --area-3: var(--citron);
  --area-1-tint: color-mix(in srgb, var(--periwinkle) 16%, transparent);
  --bar-1: var(--periwinkle);
  --bar-2: #F89C80;
  --bar-3: var(--citron);
  --past: #3A4360;                  /* 2016 beside 2021: a quiet grey */
  --past-line: #6B7593;
  --baseline: #B9C0D4;              /* benchmarks (Australia): a line */
  --bench-bar: #7D776F;             /* the comparison as a bar under the place's (the 2026 charts) */

  /* parts of a whole */
  --stack-1: var(--periwinkle); --stack-1-ink: var(--night);
  --stack-2: #F89C80;
  --stack-3: var(--citron);
  --stack-4: var(--sage);       --stack-4-ink: #FFFFFF;
  --stack-5: var(--lilac);
  --stack-other: #343D58;

  /* the street: houses in Stone, flats in periwinkle, brighter as they get taller */
  --street-flat-1: color-mix(in srgb, var(--periwinkle) 30%, var(--card));
  --street-flat-2: color-mix(in srgb, var(--periwinkle) 52%, var(--card));
  --street-flat-3: color-mix(in srgb, var(--periwinkle) 76%, var(--card));
  --street-flat-4: var(--periwinkle);

  /* Map: brightest = highest on dark. Plain hex: map.js hands these to MapLibre as text, and it can't read
     color-mix() */
  --map-1: #1B2340;
  --map-2: #263673;
  --map-3: #3B5BF2;
  --map-4: #8EA0FA;
  --map-5: #CDD5FD;
  --map-pin: #EDEFF5;
  --map-lift-shadow: var(--mint);      /* the hovered area's shadow (map.js): a faint Mint glow in the dark */
}

/* ==========================================================================
   Restraint (the consistency pass, 26 November 2026): one accent for data. The place is --area-1, the comparison a
   --baseline tick, a selection --area-1-tint. Parts of a whole are the one place a second and third colour appear,
   in a fixed order in a chart family (houses, townhouses, flats; rented, mortgage, outright): --part-1 … --part-3,
   then --part-other. Green (--primary) is the one main button in a view; amber (--warn) is "worth a look" only.
   Projected years are dashed on a pale fill (--projected-fill). Both themes: these read the theme's own tokens.
   ========================================================================== */
:root, [data-theme] {
  --part-1: var(--stack-1); --part-1-ink: var(--stack-1-ink);
  --part-2: var(--stack-2);
  --part-3: var(--stack-3);
  --part-other: var(--stack-other);
  --primary: var(--accent); --on-primary: var(--on-accent);
  --projected-fill: color-mix(in srgb, var(--area-1) 14%, transparent);
  --projected-band: color-mix(in srgb, var(--area-1) 6%, transparent);
  /* provenance dots (ProvenanceTag): where a figure comes from, the one place these colours label anything */
  --prov-census: var(--area-1);
  --prov-abs: var(--baseline);
  --prov-modelled: var(--sage);
  --prov-projected: var(--area-1);
  --prov-latest: var(--warn);
}

/* ==========================================================================
   Semantic tokens — LIGHT
   The 2026 design (DESIGN.md, the app redesign of 25 November 2026): a frost
   page with white panels joined by 1px lines, navy headings, grey body copy;
   Electric for the accent and the place, Racing green for the primary action,
   Lilac for tags and measures, Citron for the row picked out, navy for
   benchmarks and dark chips.
   ========================================================================== */
[data-theme="light"] {
  color-scheme: light;
  --bg: #F1F2F4;                   /* the page (frost) */
  --card: #FFFFFF;                 /* panels */
  --sunken: var(--mist);           /* the sidebar, side columns */
  --subtle: var(--mist);
  --quiet: #EEF0F3;
  --hover: color-mix(in srgb, var(--navy) 5%, transparent);
  --line: #D9DCE3;
  --line-soft: #E6E8ED;
  --line-strong: #C9CDD6;
  --axis: #A9AFBF;
  --dash: #C9CDD6;
  --text: var(--navy);
  --text-2: #55607A;
  --muted: #5F6982;
  --faint: #959CB0;
  --outline: var(--navy);
  --code-bg: color-mix(in srgb, var(--mint) 55%, #FFFFFF);
  --code-text: var(--navy);

  --accent: var(--racing);
  --accent-hover: color-mix(in srgb, var(--racing) 88%, #FFFFFF);
  --accent-text: var(--electric);
  --on-accent: #FFFFFF;
  --link-hover: #2541C9;
  --focus-line: var(--electric);
  --mark: var(--racing);

  --selected-bg: color-mix(in srgb, var(--electric) 10%, transparent);
  --selected-text: var(--navy);
  --pressed-bg: var(--navy);
  --pressed-text: #FFFFFF;
  --pressed-line: var(--navy);
  --hover-tint: color-mix(in srgb, var(--electric) 6%, transparent);
  --dash-accent: color-mix(in srgb, var(--electric) 35%, transparent);
  --tag-bg: transparent;
  --tag-text: var(--muted);
  --tag-line: var(--line-strong);
  --panel-tint: var(--subtle);
  --highlight: var(--area-1-tint);
  --highlight-hover: color-mix(in srgb, var(--electric) 5%, #FFFFFF);
  --highlight-text: var(--navy);
  --warn: #A67603;                 /* amber (Gold 600): "worth a look", and nothing else */
  --warn-tint: color-mix(in srgb, #CF9A35 14%, #FFFFFF);
  --warn-text: #815800;            /* amber words on --warn-tint: a cost, a near miss's failing figure, a tip */
  --contrast-bg: var(--navy);
  --contrast-hover: #2A3558;
  --contrast-text: #FFFFFF;
  --logo: var(--navy);
  --pop-shadow: 0 1px 0 rgba(30, 39, 66, .04), 0 12px 32px rgba(30, 39, 66, .06);

  /* Data: the place in Electric, a compared place in Ember (its 600 for lines and text), a third in Citron */
  --area-1: var(--electric);
  --area-2: #BD6347;
  --avatar-bg: var(--rose-600);
  --avatar-text: #FFFFFF;
  --off-text: var(--ember-700);
  --area-3: var(--citron);           /* a third series: fills only */
  --area-1-tint: color-mix(in srgb, var(--electric) 10%, #FFFFFF);
  --bar-1: var(--electric);
  --bar-2: #E98667;
  --bar-3: var(--citron);
  --past: #D9DCE3;                   /* 2016's bars: a light grey that sits back from Electric */
  --past-line: #858B9C;              /* 2016 as a line or ring: dark enough to see (3:1) */
  --baseline: var(--navy);           /* benchmarks: a line */
  --bench-bar: var(--stone);         /* the comparison as a bar under the place's (the 2026 charts) */

  /* parts of a whole, in the palette's order; white text on the dark ones */
  --stack-1: var(--electric); --stack-1-ink: #FFFFFF;
  --stack-2: #E98667;
  --stack-3: var(--citron);
  --stack-4: var(--sage);     --stack-4-ink: #FFFFFF;
  --stack-5: var(--lilac);
  --stack-other: #E6E8ED;

  /* the street: houses in Stone, flats in Electric, darker as they get taller */
  --street-flat-1: color-mix(in srgb, var(--electric) 18%, #FFFFFF);
  --street-flat-2: color-mix(in srgb, var(--electric) 40%, #FFFFFF);
  --street-flat-3: color-mix(in srgb, var(--electric) 70%, #FFFFFF);
  --street-flat-4: var(--electric);

  /* Map: pale to Electric (plain hex, as in dark) */
  --map-1: #E6EBFE;
  --map-2: #BCC8FB;
  --map-3: #8EA0FA;
  --map-4: #5B78F5;
  --map-5: #2E47C9;
  --map-pin: #1E2742;
  --map-lift-shadow: var(--navy);      /* the hovered area's shadow (map.js), navy */
}
