/* The geography figure kit (ui/figures/geo.js): the world map, the climate graph and the Sun angle.
   Builds on the shared .cx, .cx-figure rules in styles.css, and (for the climate graph) on the .cg-* chart rules in styles/widgets/climate-graph.css. */

/* ---- Colours -----------------------------------------------------------------------------------------------------
   The land and the three solar zones. Each fill is at least 3:1 against the card (--surface) in both themes (tests/ui-figures.test.js and
   the browser sweep measure it). The zones are also told apart without colour: the dashed lines between them, their names in the key,
   and the lines of the map's own labels. The tint of the sea is decoration. */
:root {
  --geo-land: #7d859b;
  --geo-tropical: #e8590c;
  --geo-temperate: #1f8a4c;
  --geo-polar: #3b5bdb;
  --geo-sea: color-mix(in srgb, var(--accent) 9%, var(--surface));
  --geo-ground: color-mix(in srgb, var(--muted) 32%, var(--surface));
  --geo-beam: color-mix(in srgb, var(--glow) 40%, var(--surface));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --geo-land: #6f7794;
    --geo-tropical: #ff922b;
    --geo-temperate: #5fd08a;
    --geo-polar: #8ea2ff;
    --geo-beam: color-mix(in srgb, var(--glow) 28%, var(--surface));
  }
}
:root[data-theme="dark"] {
  --geo-land: #6f7794;
  --geo-tropical: #ff922b;
  --geo-temperate: #5fd08a;
  --geo-polar: #8ea2ff;
  --geo-beam: color-mix(in srgb, var(--glow) 28%, var(--surface));
}

/* The chart of the climate graph figure takes the widget's colours (6.1:1 and 5.6:1 on the card). */
.cx-figure--climate-graph {
  --cg-rain: #2563a8;
  --cg-rain-text: #1d4f8a;
  --cg-temp: #c62828;
  --cg-temp-text: #b71c1c;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cx-figure--climate-graph {
    --cg-rain: #6cb2f5;
    --cg-rain-text: #8cc4f8;
    --cg-temp: #ff8a80;
    --cg-temp-text: #ff9e95;
  }
}
:root[data-theme="dark"] .cx-figure--climate-graph {
  --cg-rain: #6cb2f5;
  --cg-rain-text: #8cc4f8;
  --cg-temp: #ff8a80;
  --cg-temp-text: #ff9e95;
}

/* ---- The picture ------------------------------------------------------------------------------------------------- */
.cx-figure--world-map, .cx-figure--climate-graph { max-width: 440px; }
.cx-figure--sun-angle { max-width: 440px; }
.cx-figure--sun-angle:has(.geo-panels) { max-width: 760px; }
/* Text is at least 12 units of a 320-unit picture, bold: the width estimate (textWidth in data-chart.js) is for bold text. */
.geo-text { font-size: 13px; font-weight: 600; fill: var(--text); font-family: inherit; font-variant-numeric: tabular-nums; }
.geo-text--muted { fill: var(--muted); }
.geo-text--strong { font-weight: 800; }
/* A ring of the card's colour round a text that sits on the land, on a line or on a ray, so nothing runs through the letters. */
.geo-halo { paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }

/* ---- world-map ----------------------------------------------------------------------------------------------------- */
.geo-sea { fill: var(--geo-sea); stroke: none; }
.geo-land { fill: var(--geo-land); stroke: var(--surface); stroke-width: 0.5; stroke-linejoin: round; }
.geo-zone--tropical { fill: var(--geo-tropical); }
.geo-zone--temperate { fill: var(--geo-temperate); }
.geo-zone--polar { fill: var(--geo-polar); }
.geo-zone-edge { stroke: var(--wire); stroke-width: 1; stroke-dasharray: 5 4; opacity: 0.8; }
.geo-grid { stroke: var(--axis); stroke-width: 0.6; opacity: 0.55; }
.geo-index-line { stroke: var(--wire); stroke-width: 1.5; }
.geo-frame { fill: none; stroke: var(--wire); stroke-width: 1.5; }
/* The named lines each have their own style, so they differ by more than colour: the equator and the prime meridian are solid (one runs
   across the map and the other down it), the tropics are dashed, the polar circles dotted, the date line dashed with dots, in orange (it lies on the frame of a whole-world map). */
.geo-line { stroke: var(--wire); stroke-width: 2.5; fill: none; }
.geo-line--tropic-of-cancer, .geo-line--tropic-of-capricorn { stroke-width: 2.2; stroke-dasharray: 9 5; }
.geo-line--arctic-circle, .geo-line--antarctic-circle { stroke-width: 2.4; stroke-dasharray: 1 5; stroke-linecap: round; }
.geo-line--date-line { stroke: var(--user-line); stroke-width: 3.2; stroke-dasharray: 10 4 2 4; } /* orange, so it shows on the frame it lies on */
.geo-point { fill: var(--text); stroke: var(--surface); stroke-width: 2; }
.geo-swatch { stroke: var(--wire); stroke-width: 1; }
.geo-swatch--tropical { fill: var(--geo-tropical); }
.geo-swatch--temperate { fill: var(--geo-temperate); }
.geo-swatch--polar { fill: var(--geo-polar); }

/* ---- climate-graph --------------------------------------------------------------------------------------------------
   The chart is the widget's (.cg-* rules); a highlighted month has a tinted column behind it, a heavier outline on its bar, a
   filled point and a bold letter, so it shows without colour too. */
.cg-highlight { fill: color-mix(in srgb, var(--accent) 24%, var(--surface)); stroke: var(--accent); stroke-width: 1.5; }
.cg-bar.is-highlight { stroke: var(--text); stroke-width: 2.5; }
.cg-point.is-highlight { fill: var(--cg-temp); stroke: var(--text); stroke-width: 2; }
.cg-month.is-highlight { fill: var(--text); font-weight: 800; }
.geo-legend { margin-top: 0.5rem; }
.geo-legend .geo-legend-highlight::before { border: 1.5px solid var(--accent); background: color-mix(in srgb, var(--accent) 24%, var(--surface)); }

/* ---- sun-angle ------------------------------------------------------------------------------------------------------
   Rays and the beam are in --user-line (the colour of "what you look at"), the angle's arc and the ground in the text colour. The beam's strip
   on the ground is the heaviest stroke, so a low Sun's longer strip is plain to see. Two panels sit side by side when there is room. */
.geo-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 0.5rem; }
.geo-ground { fill: var(--geo-ground); stroke: none; }
.geo-ground-line { stroke: var(--wire); stroke-width: 3; }
.geo-ray { stroke: var(--user-line); stroke-width: 2.5; stroke-linecap: round; }
.geo-ray-head { fill: none; stroke: var(--user-line); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.geo-beam { fill: var(--geo-beam); stroke: none; }
.geo-strip { stroke: var(--user-line); stroke-width: 7; stroke-linecap: butt; }
.geo-arc { fill: none; stroke: var(--text); stroke-width: 2; }
.geo-sun { fill: var(--glow); stroke: var(--wire); stroke-width: 2; }
.geo-sun-ray { stroke: var(--wire); stroke-width: 2; stroke-linecap: round; }
