:root {
  --ink: #0F1B2D;
  --muted: #5B6B7F;
  --paper: #F3F6F8;
  --rule: #D5DDE5;
  --tint: #E6ECF1;
  --blue: #2166AC;
  --red: #B2182B;
  --gutter: 1.4rem;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Schibsted Grotesk", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

#app { display: grid; grid-template-columns: minmax(0, 1fr) clamp(360px, 32vw, 460px); height: 100vh; }

/* map side */
#mapwrap { position: relative; min-width: 0; }
#map { position: absolute; inset: 0; }
#search {
  position: absolute; z-index: 1000; top: 12px; left: 56px; right: 12px;
  max-width: 420px; display: flex; gap: 6px;
}
#search input {
  flex: 1; min-width: 0; padding: .6rem .8rem; border: 1px solid var(--rule); border-radius: 6px;
  font: inherit; background: #fff; box-shadow: 0 1px 4px rgba(15, 27, 45, .18);
}
#search button {
  padding: .6rem 1rem; border: 0; border-radius: 6px; background: var(--ink); color: #fff;
  font: inherit; font-weight: 500; cursor: pointer;
}

/* panel */
/* the top block (title bar, stripes, caption) stays put; only the results below it scroll */
#panel {
  background: var(--paper); min-width: 0; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column; border-left: 1px solid var(--rule);
}
#top { flex: none; max-height: 62%; overflow-y: auto; background: var(--paper); border-bottom: 1px solid var(--rule); padding-bottom: .6rem; }
#out { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }

.brand {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem var(--gutter) .8rem; font-weight: 700;
}
.brand label { font-weight: 400; font-size: .85rem; color: var(--muted); }
.brand select { font: inherit; font-size: .85rem; padding: .15rem .3rem; color: var(--ink); }

/* the stripes: one bar per year, blue below average, red above */
#stripes {
  display: block; width: 100%; height: 84px;
  background: repeating-linear-gradient(90deg, var(--tint) 0 9px, var(--paper) 9px 11px);
}
#stripes.loading { animation: shimmer 1.1s ease-in-out infinite alternate; }
#stripes rect { transform-box: fill-box; transform-origin: bottom; }
#stripes.reveal rect { animation: rise .55s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i) * 14ms); }
@keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes shimmer { from { opacity: .45; } to { opacity: 1; } }

.caption { margin: .5rem var(--gutter) 0; font-size: .78rem; color: var(--muted); min-height: 1.2rem; }

/* text blocks */
#out { padding-bottom: 2rem; }
#head .legend { margin-bottom: .2rem; }
.intro, .verdict, .coord, .legend, .examples, .error, .missing, .source {
  margin: .8rem var(--gutter) 0; line-height: 1.5;
}
.intro { font-size: 1.05rem; }
.examples { font-size: .92rem; color: var(--muted); }
.link {
  border: 0; background: none; padding: 0; margin-right: .7rem; font: inherit; color: var(--ink);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.place { margin: 1.1rem var(--gutter) 0; font-size: 1.85rem; line-height: 1.1; font-weight: 700; letter-spacing: -.01em; }
.coord { margin-top: .3rem; font-size: .82rem; color: var(--muted); }
.verdict { font-size: 1.1rem; margin-top: 1rem; }
.source { margin: .5rem var(--gutter) 0; font-size: .8rem; line-height: 1.45; color: var(--muted); }
/* expandable sections: Temperature, Water, Sun wind and air */
.ghead {
  display: flex; align-items: center; gap: .7rem; width: 100%; text-align: left;
  padding: .85rem var(--gutter); border: 0; border-top: 1px solid var(--rule);
  background: none; font: inherit; font-size: .82rem; color: var(--muted); cursor: pointer;
}
.ghead:hover { background: var(--tint); }
.ghead b { flex: 1; color: var(--ink); font-size: .98rem; }
.chev {
  flex: none; width: 0; height: 0; border-left: 6px solid var(--muted);
  border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform .15s;
}
.ghead[aria-expanded="true"] .chev { transform: rotate(90deg); }
.gbody[hidden] { display: none; }
.legend { font-size: .82rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; margin-bottom: 1rem; }
.legend .mark + .mark { margin-left: .8rem; }
.error { color: var(--red); }
.missing { font-size: .82rem; color: var(--muted); }

/* the dot that says whether a change is real */
.mark {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  border: 1.5px solid var(--muted); flex: none;
}
.mark.on, .row.sig .mark { background: var(--ink); border-color: var(--ink); }

/* variable rows */
.row {
  display: grid; grid-template-columns: 14px minmax(0, 1fr) 64px minmax(96px, auto); align-items: center; gap: .7rem;
  width: 100%; text-align: left; border: 0; border-top: 1px solid var(--rule); background: none;
  padding: .7rem var(--gutter); font: inherit; color: var(--muted); cursor: pointer;
}
.row:hover, .row.active { background: var(--tint); }
.row .label { color: var(--ink); }
.row.active .label { font-weight: 700; }
.row.ns .label { color: var(--muted); }
.row.up { color: var(--red); }
.row.down { color: var(--blue); }
.spark { width: 64px; height: 22px; display: block; }
.delta { text-align: right; display: flex; flex-direction: column; line-height: 1.15; }
.delta b { font-size: 1.02rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.delta i { font-style: normal; font-size: .72rem; color: var(--muted); }
#rows { border-bottom: 1px solid var(--rule); }

/* opened row */
#detail { padding: .3rem var(--gutter) 1.2rem; border-top: 1px solid var(--rule); background: var(--paper); }
#detail[hidden] { display: none; }
#detail img { width: 100%; display: block; margin: .6rem 0; }
.sentence { font-size: 1rem; line-height: 1.5; margin: .7rem 0 0; }
.note { font-size: .82rem; color: var(--muted); line-height: 1.5; margin: 0; }

.method { margin: 1rem var(--gutter) 0; font-size: .85rem; color: var(--muted); line-height: 1.5; }
.method summary { cursor: pointer; color: var(--ink); }

/* place pins: A is filled, B is outlined */
.pin {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 24px; height: 24px; border-radius: 50%; font-size: .8rem; font-weight: 700;
  box-shadow: 0 0 0 2px #fff;
}
.pin-a { background: var(--ink); color: #fff; }
.pin-b { background: #fff; color: var(--ink); border: 2px solid var(--ink); }

/* compare mode */
.slot { margin: .5rem var(--gutter) 0; min-height: 1.4rem; }
.hint { margin: 0; font-size: .9rem; color: var(--muted); }
.link.strong { font-weight: 700; margin-right: 0; }
#mapwrap.picking .leaflet-container { cursor: crosshair; }
#stripes.two { height: 112px; }
.place.small { display: flex; align-items: center; gap: .6rem; font-size: 1.2rem; margin-top: .6rem; }
.place.small:first-of-type { margin-top: 1.1rem; }

.chead, .crow {
  display: grid; grid-template-columns: minmax(0, 1fr) 92px 92px; align-items: center; gap: .6rem;
  width: 100%; padding: .7rem var(--gutter);
}
.chead { position: sticky; top: 0; z-index: 1; background: var(--paper); padding-top: .5rem; padding-bottom: .5rem; justify-items: end; }
.crow {
  text-align: left; border: 0; border-top: 1px solid var(--rule); background: none;
  font: inherit; color: var(--muted); cursor: pointer;
}
.crow:hover, .crow.active { background: var(--tint); }
.crow.opp { box-shadow: inset 4px 0 0 var(--ink); }
.crow .label { color: var(--ink); }
.crow.active .label { font-weight: 700; }
.tag { display: block; font-size: .72rem; font-weight: 700; color: var(--ink); }
.cell { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.cell .line { display: flex; align-items: center; gap: .4rem; }
.cell b { font-size: 1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.cell i { font-style: normal; font-size: .72rem; color: var(--muted); }
.cell.up { color: var(--red); }
.cell.down { color: var(--blue); }
.cell.ns { color: var(--muted); }
.cell.none { font-size: .8rem; color: var(--muted); }
.cell.sig .mark { background: var(--ink); border-color: var(--ink); }

@media (max-width: 800px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 40vh minmax(0, 1fr); height: 100vh; }
  #panel { border-left: 0; border-top: 1px solid var(--rule); }
}

@media (prefers-reduced-motion: reduce) {
  #stripes.loading, #stripes.reveal rect { animation: none; }
}
