/* ALTO shared components (map panel, tree page, Area dashboard), on the ALTO design system v1.0 tokens.
   Dark values apply on the tree page only (the map app is light: <html data-theme="light">). */
:root {
  /* Values from the ALTO design system v1.0 (tokens.css). The map loads tokens.css first, so these restate
     the same values under the tool v0.1/v0.2 names (tokens.css "legacy aliases"); the tree page does not load
     tokens.css yet and reads them from here. New rules use the design-system names (--color-*, --space-*,
     --radius-*, --control-*, --font-sans, --viz-*). */
  --alto-green: #4a6f46; --alto-green-600: #3e5f3b; --alto-green-700: #2f4a2d; --alto-green-50: #f2f6f0; --alto-green-100: #e4ede0; --alto-green-200: #cbdcc4;
  --bpl-navy: #0c0c48;
  --ink: #17201a; --ink-2: #33403a; --muted: #5b655f; --faint: #8a938d; --line: #d8ddd6; --line-soft: #e9ede7;
  --surface: #f7f8f5; --panel: #ffffff; --card: #ffffff; --card-2: #f7f8f5;
  --protected: #b02e6f; --unlinked: #8a938d; --warn-bg: #fbf3e6; --warn-ink: #7a4b12;
  --water: #16558c; --carbon: #3ca17b; --air: #9e6ec0; --cool: #bc662f;
  --viz-crown: #6ac19d; --viz-crown-line: #147656; --viz-trunk: #8a6a4a; --viz-ref: #5b655f; --viz-house: #d8ddd6; --viz-axis: #b9c0ba; --viz-grid: #e9ede7;
  --fs-2xs: 11px; --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 20px; --fs-2xl: 28px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-6: 24px; --sp-8: 32px;
  /* Left panel line heights (concept A): each size has a fixed line height on the 4-px grid. */
  --lh-2xs: 16px; --lh-xs: 16px; --lh-sm: 18px; --lh-md: 20px; --lh-lg: 24px; --lh-xl: 24px;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px;
  --shadow-1: 0 1px 2px rgb(23 32 26 / 6%), 0 4px 16px rgb(23 32 26 / 7%);
  --shadow-2: 0 2px 6px rgb(23 32 26 / 8%), 0 16px 40px rgb(23 32 26 / 14%);
  --panel-inset: 12px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font: "ALTO Inter", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- buttons, tags, badges ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font: 600 var(--fs-md)/1.2 var(--font); text-decoration: none; cursor: pointer;
  transition: background 160ms var(--ease), border-color 160ms var(--ease), transform 160ms var(--ease), box-shadow 160ms var(--ease); }
.btn:hover { border-color: var(--alto-green-200); background: var(--alto-green-50); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--alto-green); border-color: var(--alto-green); color: #fff; box-shadow: none; } /* no shadows on buttons (design system 2.1) */
.btn-primary:hover { background: var(--alto-green-600); border-color: var(--alto-green-600); }
.btn-quiet { background: var(--card-2); border-color: transparent; color: var(--alto-green-700); font-weight: 600; font-size: var(--fs-sm); min-height: 38px; padding: 7px 10px; }
.btn-quiet[aria-pressed="true"] { background: var(--alto-green-100); }
.btn .ico { flex: 0 0 auto; }
.link-button { appearance: none; border: 0; background: none; padding: 6px 0; color: var(--alto-green); font: 600 var(--fs-sm)/1.3 var(--font); text-align: left; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.tag { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 999px; background: var(--alto-green-100); color: var(--alto-green-700);
  font: 650 10.5px/1 var(--font); letter-spacing: .02em; text-transform: uppercase; vertical-align: 2px; font-style: normal; }
.badge { display: inline-flex; align-items: center; gap: 5px; min-height: 26px; padding: 3px 9px; border-radius: 999px; background: var(--card-2); color: var(--ink-2);
  font: 600 var(--fs-xs)/1.25 var(--font); border: 1px solid var(--line-soft); }
.badge-protected { background: var(--protected); color: #fff; border-color: var(--protected); }
.badge-notable { background: #f3ead9; color: #6d5226; border-color: #e6d6b6; }
.badge-good { background: var(--alto-green-50); color: var(--alto-green-700); border-color: var(--alto-green-100); }
.badge-warn { background: var(--warn-bg); color: var(--warn-ink); border-color: #efdcbc; }
.badge-muted { color: var(--muted); }
.skeleton { border-radius: 10px; background: linear-gradient(100deg, #e9efe6 30%, #f5f8f2 50%, #e9efe6 70%); background-size: 200% 100%; animation: alto-shimmer 1.2s linear infinite; }
@keyframes alto-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* ---- visualisations ---- */
.viz { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font); }
.viz .v-crown, .viz .v-crown-fill { fill: var(--viz-crown); stroke: var(--viz-crown-line); stroke-width: 1; stroke-linejoin: round; }
.viz path.v-crown[fill="none"] { fill: none; stroke: var(--viz-crown-line); stroke-linecap: round; }
.viz .v-trunk { fill: var(--viz-trunk); }
.viz .v-ref circle { fill: var(--viz-ref); } .viz .v-ref path { stroke: var(--viz-ref); stroke-linecap: round; }
.viz .v-house path { fill: var(--viz-house); stroke: #c3cabf; stroke-width: 1; } .viz .v-house .v-house-line { stroke: #c3cabf; stroke-dasharray: 2 2; }
.viz .v-axis { stroke: var(--viz-axis); stroke-width: 1; fill: none; } .viz .v-grid { stroke: var(--viz-grid); stroke-width: 1; }
.viz .v-ground { stroke: #bfc7bb; stroke-width: 1.5; }
.viz .v-mark { stroke: var(--alto-green); stroke-width: 1.5; }
.viz .v-tick { fill: var(--muted); font-size: 9.5px; }
.viz .v-label { fill: var(--ink-2); font-size: 10.5px; font-weight: 600; }
.viz .v-value { fill: var(--ink); font-size: 10.5px; font-weight: 700; }
.viz .v-car rect { fill: #cfd6dc; stroke: #9aa6b0; stroke-width: 1; }
.viz .v-bark { fill: #c9a57d; stroke: #7d5a3a; stroke-width: 2; } .viz .v-ring { fill: none; stroke: #a8835c; stroke-width: .8; opacity: .7; }
.viz .v-band { fill: none; stroke: rgb(74 111 70 / 22%); }
.viz .v-line { stroke: var(--alto-green); stroke-width: 2; fill: none; }
.viz .v-dot { fill: var(--alto-green); stroke: #fff; stroke-width: 1.5; }
.viz .v-dot-missing { fill: var(--panel); stroke: var(--faint); stroke-width: 1.5; stroke-dasharray: 2 1.5; }
.viz .v-scenario { stroke: var(--alto-green); stroke-width: 1.5; stroke-dasharray: 4 3; fill: none; }
.viz .v-dot-scenario { fill: var(--panel); stroke: var(--alto-green); stroke-width: 1.5; }
.viz .v-band-area { fill: rgb(74 111 70 / 12%); }
.viz .v-col { fill: var(--alto-green); opacity: .85; }
.viz .v-year { font-weight: 650; fill: var(--ink-2); }
.viz-empty { display: flex; align-items: center; gap: 8px; min-height: 64px; padding: 10px 12px; border-radius: 10px; background: var(--card-2); color: var(--muted); font-size: var(--fs-sm); line-height: 1.4; }

.stage-strip { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; align-items: end; }
.stage-strip li { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px 6px; border-radius: 10px; color: #b4bcb5; position: relative; }
.stage-strip li::after { content: ""; position: absolute; left: 10%; right: 10%; bottom: 0; height: 3px; border-radius: 2px; background: var(--line-soft); }
.stage-strip li.is-past { color: #93a98d; } .stage-strip li.is-past::after { background: var(--alto-green-200); }
.stage-strip li.is-current { color: var(--alto-green); background: var(--alto-green-50); } .stage-strip li.is-current::after { background: var(--alto-green); }
.stage-ico { display: grid; place-items: end center; height: 32px; }
.stage-label { font: 600 11px/1.15 var(--font); color: var(--muted); text-align: center; }
.stage-strip li.is-current .stage-label { color: var(--alto-green-700); font-weight: 700; }

.benefit-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.benefit { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto auto; column-gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--card-2); border: 1px solid var(--line-soft); min-width: 0; }
.benefit-ico { grid-row: 1 / span 3; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: #fff; }
.benefit-water .benefit-ico { background: var(--water); } .benefit-carbon .benefit-ico { background: var(--carbon); } .benefit-air .benefit-ico { background: var(--air); } .benefit-cool .benefit-ico { background: var(--cool); }
.benefit-label { font: 600 11.5px/1.2 var(--font); color: var(--muted); }
.benefit strong { font: 750 var(--fs-lg)/1.25 var(--font); color: var(--ink); font-variant-numeric: tabular-nums; }
.benefit small { font-size: 11px; line-height: 1.3; color: var(--muted); }
.benefit-tiles.is-compact .benefit { padding: 8px 10px; }

.irr-meter { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; margin: 2px 0 6px; }
.irr-meter span { height: 8px; border-radius: 4px; background: var(--line-soft); }
.irr-meter span.on { background: linear-gradient(90deg, #9cbf8a, var(--alto-green)); }
.irr-meter span.on:nth-child(4), .irr-meter span.on:nth-child(5) { background: var(--alto-green-700); }
.irr-label { font: 700 var(--fs-md)/1.3 var(--font); color: var(--ink); }

.comp-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; background: var(--line-soft); }
.comp-bar span { min-width: 3px; }
.comp-legend { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; font-size: var(--fs-sm); }
.comp-legend li { display: grid; grid-template-columns: 10px 1fr auto 44px; align-items: center; gap: 8px; }
.comp-legend i { width: 10px; height: 10px; border-radius: 3px; }
.comp-legend b { font-variant-numeric: tabular-nums; font-weight: 650; }
.comp-legend small { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.prob-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: var(--fs-sm); }
.prob-bars li { display: grid; grid-template-columns: minmax(120px, 1fr) 2fr 44px; align-items: center; gap: 10px; }
.prob-track { height: 8px; border-radius: 4px; background: var(--line-soft); overflow: hidden; }
.prob-track span { display: block; height: 100%; background: #9db892; border-radius: 4px; }
.prob-bars li.is-top .prob-track span { background: var(--alto-green); }
.prob-bars b { text-align: right; font-variant-numeric: tabular-nums; }
.prob-bars b small { display: block; font: 400 var(--fs-2xs, 11px)/1.2 var(--font-sans); color: var(--color-text-muted, #5b655f); white-space: nowrap; }
.prob-bars li:has(b small) { grid-template-columns: minmax(120px, 1fr) 2fr 72px; }

.kpis { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpi { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: start; padding: 10px 12px; border-radius: 12px; background: var(--card-2); border: 1px solid var(--line-soft); min-width: 0; }
.kpi-ico { grid-row: 1 / span 3; color: var(--alto-green); padding-top: 2px; }
.kpi-label { font: 600 11.5px/1.2 var(--font); color: var(--muted); }
.kpi strong { font: 750 18px/1.25 var(--font); font-variant-numeric: tabular-nums; color: var(--ink); overflow-wrap: anywhere; }
.kpi strong small { font-size: 11px; font-weight: 600; color: var(--muted); }
.kpi > small { font-size: 11px; line-height: 1.3; color: var(--muted); }
.viz .v-leader { stroke: var(--alto-green); stroke-width: 1; stroke-dasharray: 3 3; fill: none; opacity: .8; }
.beta-pill { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; background: #f3e7c8; color: #6b4e12; font: 750 10.5px/1 var(--font); letter-spacing: .06em; text-transform: uppercase; vertical-align: 1px; }
.beta-back { font-size: 12px; font-weight: 600; color: var(--alto-green); margin-left: 4px; }
.tpg-top .beta-pill { margin-right: auto; margin-left: 10px; }

/* ---- v0.2 review: data-sheet components (real-data graphics only) ---- */
.chip { margin: 0; min-width: 0; }
.chip-frame { position: relative; width: 100%; overflow: hidden; border-radius: 10px; background: #dfe5dc; }
.chip-frame img { position: absolute; display: block; max-width: none; user-select: none; }
.chip-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.chip-outline { fill: rgb(255 255 255 / 8%); stroke: #ffe14d; stroke-width: 2.2; stroke-linejoin: round; paint-order: stroke; }
.chip-recorded { fill: none; stroke: #ffffff; stroke-width: 2; }
.chip-scale rect { fill: rgb(0 0 0 / 55%); }
.chip-scale path { stroke: #fff; stroke-width: 1.5; fill: none; }
.chip-scale text { fill: #fff; font: 600 10px/1 var(--font); }
.viz .v-band-bar { fill: var(--alto-green); opacity: .8; }
.viz .v-ref { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 2; fill: none; }
.viz .v-outline { fill: rgb(74 111 70 / 22%); stroke: var(--alto-green); stroke-width: 1.4; stroke-linejoin: round; }
.viz .v-strong { fill: var(--ink); font-weight: 700; }
.viz-none { margin: 0; font-size: var(--fs-sm); color: var(--muted); }
.ds { margin: 0; display: grid; }
.ds-row { display: grid; grid-template-columns: minmax(96px, 34%) 1fr; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line-soft); font-size: 13.5px; }
.ds-row:first-child { border-top: 0; }
.ds-row dt { color: var(--muted); }
.ds-row dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.ds-row dd small { display: block; margin-top: 1px; font-weight: 400; font-size: 12px; color: var(--muted); }
.stage-scale { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.stage-scale li { display: grid; gap: 1px; padding: 6px 4px; text-align: center; border-left: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.stage-scale li:first-child { border-left: 0; }
.stage-scale li b { font-weight: 600; color: var(--ink-2); }
.stage-scale li span { font-size: 10.5px; font-variant-numeric: tabular-nums; }
.stage-scale li.is-current { background: var(--ink); color: #fff; }
.stage-scale li.is-current b, .stage-scale li.is-current span { color: #fff; }
.id-list { list-style: none; margin: 0; padding: 0; display: grid; }
.id-list li { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; column-gap: 10px; padding: 5px 0; border-top: 1px solid var(--line-soft); font-size: 12.5px; }
.id-list li:first-child { border-top: 0; }
.id-list .id-kind { color: var(--muted); }
.id-list code { font-size: 11.5px; overflow-wrap: anywhere; }
.id-list code a { color: var(--alto-green); }
.id-list small { grid-column: 2; color: var(--muted); font-size: 11.5px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stage-scale li.is-current { background: var(--alto-green); color: #0f1a12; } :root:not([data-theme="light"]) .stage-scale li.is-current b, :root:not([data-theme="light"]) .stage-scale li.is-current span { color: #0f1a12; } }

/* The Notable Trees schedule in charts: its segment and swatch carry the schedule ring (a mark, not only a colour). */
.comp-bar span.is-ringed { box-shadow: inset 0 0 0 2px var(--color-protected, #b02e6f); }
.comp-legend i.is-ringed { box-shadow: inset 0 0 0 1px var(--color-surface, #fff), 0 0 0 2px var(--color-protected, #b02e6f); }

/* A11Y-03: keyboard focus on a map (the map page and the tree page's inset map) is a two-tone ring drawn inside the
   canvas, on top of the map: dark green outside, white inside. Whatever the pixel beside it (aerial imagery, the light
   basemap, either theme), one of the two stands at 3.6:1 or more against it. Drawn inside because the map clips
   anything outside it; the inner ring sits on the canvas container (a canvas has no ::after). */
.maplibregl-map .maplibregl-canvas:focus-visible { outline: 3px solid var(--alto-green-800); outline-offset: -3px; }
.maplibregl-map .maplibregl-canvas-container:has(> .maplibregl-canvas:focus-visible)::after { content: ""; position: absolute; inset: 3px; z-index: 1; box-shadow: inset 0 0 0 2px var(--neutral-0); pointer-events: none; }
