/* Ntontan atlas — map page. Tokens come from the shared brand kit
   (brand-kit/css/ntontan-theme.css): --ink, --paper, --paper-dim, --heat,
   --flora, --muted, --hairline, --display, --body, --label, --step-*. */

.atlas-stamp {
  display: flex; flex-wrap: wrap; gap: .35rem 1.4rem;
  font-family: var(--label); font-size: var(--step--1); color: var(--muted);
  margin: .2rem 0 1.1rem;
}
.atlas-stamp strong { color: var(--ink); font-weight: 500; }

/* Keep the app in the page column, clear of Quarto's full-width grid rules */
.atlas-shell { grid-column: page-start / page-end; min-width: 0; }

/* ---- Toolbar: search + lenses ------------------------------------------------ */
.atlas-toolbar {
  display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: .8rem 1.2rem;
  align-items: start; padding: .9rem 1rem; border: 1px solid var(--hairline);
  border-bottom: 0; background: var(--paper);
}
.atlas-search-wrap { position: relative; }
.atlas-search-wrap label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
#atlas-search {
  width: 100%; font: 400 1rem var(--body); color: var(--ink);
  padding: .62rem .8rem .62rem 2.2rem; border: 1px solid var(--ink); border-radius: 0;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%231f1f1f' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 4 4'/%3E%3C/svg%3E") no-repeat .7rem center;
}
#atlas-search:focus { outline: 2px solid var(--heat); outline-offset: 1px; }
#atlas-search-list {
  position: absolute; z-index: 1200; left: 0; right: 0; top: 100%; margin: 0; padding: 0;
  list-style: none; background: #fff; border: 1px solid var(--ink); border-top: 0;
  max-height: 300px; overflow-y: auto; box-shadow: 0 10px 24px rgba(31,31,31,.12);
}
#atlas-search-list li { padding: .5rem .8rem; cursor: pointer; font-size: .95rem; }
#atlas-search-list li:hover, #atlas-search-list li.active { background: var(--paper-dim); }
#atlas-search-list li.empty { color: var(--muted); cursor: default; }

.atlas-lenses { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; }
.lens-group { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.lens-group-label {
  font-family: var(--label); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin-right: .15rem;
}
.lens-chip {
  font: 500 .86rem var(--body); color: var(--ink); background: transparent;
  border: 1px solid var(--hairline); border-radius: 999px; padding: .3rem .75rem; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.lens-chip:hover { border-color: var(--ink); }
.lens-chip:focus-visible { outline: 2px solid var(--heat); outline-offset: 2px; }
.lens-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.atlas-lens-select { display: none; }

/* ---- Map + panel ------------------------------------------------------------------ */
.atlas-app {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px;
  border: 1px solid var(--hairline); background: var(--paper);
  height: min(78vh, 760px); min-height: 560px;
}
#atlas-map { height: 100%; background: var(--paper-dim); font-family: var(--body); }
.atlas-panel { border-left: 1px solid var(--hairline); overflow-y: auto; background: var(--paper); }
.panel-pad { padding: 1.3rem 1.4rem 1.6rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; }
.panel-head .eyebrow, .atlas-panel .eyebrow { margin: 0; }
.panel-title { font-family: var(--display); font-size: var(--step-1); line-height: 1.1; margin: .5rem 0 .35rem; color: var(--ink); }
.panel-sub, .panel-def { color: var(--muted); font-size: .93rem; margin: 0 0 .8rem; }
.panel-med { margin: .4rem 0 .2rem; }
.panel-cta { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--hairline); font-weight: 500; }
.panel-note { color: var(--muted); font-size: .85rem; margin: .4rem 0; }
.panel-src { color: var(--muted); font-size: .8rem; margin-top: 1.2rem; padding-top: .8rem; border-top: 1px solid var(--hairline); }
.panel-src a { color: var(--ink); text-decoration-color: var(--heat); }
.flag {
  font-size: .82rem; margin: .3rem 0; padding: .35rem .6rem;
  border-left: 3px solid #c98500; background: #fbf3df; color: var(--ink);
}

.lens-focus { margin: 1rem 0 .6rem; padding: .9rem 1rem .6rem; background: var(--paper-dim); }
.lf-label { font-family: var(--label); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.lf-value { font-family: var(--display); font-size: var(--step-2); line-height: 1.05; color: var(--ink); margin: .15rem 0; }
.lf-cmp { font-size: .88rem; color: var(--muted); }

.strip { width: 100%; height: auto; display: block; margin-top: .4rem; overflow: visible; }
.strip .axis { stroke: rgba(31,31,31,.25); stroke-width: 1; }
.strip .med { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 2 2; }
.strip .dot { fill: rgba(31,31,31,.28); }
.strip .me { fill: var(--heat); stroke: #fff; stroke-width: 2; }
.strip .lab, .trend .lab { font: 400 9.5px var(--body); fill: var(--muted); }

.panel-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin: .2rem 0 .4rem; }
.btn-sm { font-size: .8rem !important; padding: .4rem .8rem !important; }
.icon-btn {
  border: 1px solid var(--hairline); background: transparent; color: var(--ink);
  width: 2rem; height: 2rem; font-size: 1.2rem; line-height: 1; cursor: pointer;
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn.sm { width: 1.4rem; height: 1.4rem; font-size: .9rem; vertical-align: middle; }

.sec {
  font-family: var(--label); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--flora); margin: 1.3rem 0 .4rem; padding-bottom: .3rem; border-bottom: 1px solid var(--hairline);
}
.atlas-panel dl { margin: 0; }
.kv { display: flex; justify-content: space-between; gap: 1rem; padding: .28rem 0; font-size: .92rem; }
.kv dt { font-weight: 400; color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; text-align: right; color: var(--ink); white-space: nowrap; }
.hint {
  display: inline-grid; place-items: center; width: 1rem; height: 1rem; border-radius: 50%;
  border: 1px solid var(--hairline); font-size: .65rem; color: var(--muted); cursor: help;
}
.trend-wrap { margin-top: .6rem; }
.mini-label { font-size: .8rem; color: var(--muted); }
.trend { width: 100%; height: auto; display: block; overflow: visible; }
.trend .line { fill: none; stroke: var(--heat); stroke-width: 2; }
.trend .pt { fill: var(--heat); }

/* ---- Leaflet chrome ---------------------------------------------------------------------- */
.atlas-legend {
  background: var(--paper); border: 1px solid var(--hairline); padding: .65rem .8rem;
  font-family: var(--body); font-size: .74rem; line-height: 1.3; color: var(--ink);
  box-shadow: 0 6px 18px rgba(31,31,31,.1);
}
.atlas-legend .lg-title { font-weight: 500; margin-bottom: .3rem; }
.atlas-legend ul { list-style: none; margin: 0; padding: 0; }
.atlas-legend li { display: flex; align-items: center; gap: .45rem; margin: .12rem 0; }
.atlas-legend .sw { width: 14px; height: 10px; flex: none; border: 1px solid rgba(31,31,31,.12); }
.atlas-legend .lg-note { color: var(--muted); font-size: .68rem; margin-top: .3rem; }
.leaflet-tooltip.atlas-tip {
  font-family: var(--body); font-size: .85rem; color: var(--ink); background: var(--paper);
  border: 1px solid var(--ink); border-radius: 0; box-shadow: none; padding: .35rem .55rem;
}
.leaflet-container .leaflet-control-attribution { font-family: var(--body); font-size: .68rem; }
.leaflet-bar a { color: var(--ink); border-radius: 0 !important; }

/* ---- Compare ------------------------------------------------------------------------------------ */
.atlas-compare { border: 1px solid var(--hairline); border-top: 0; padding: 1rem 1.2rem 1.2rem; background: var(--paper); }
.cmp-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.cmp-head h2 { font-family: var(--display); font-size: var(--step-1); margin: 0 0 .6rem; }
.cmp-hint { color: var(--muted); font-size: .85rem; }
.cmp-scroll { overflow-x: auto; }
table.cmp { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 520px; }
table.cmp th, table.cmp td { padding: .45rem .6rem; border-bottom: 1px solid var(--hairline); text-align: right; }
table.cmp tbody th { text-align: left; font-weight: 400; color: var(--muted); }
table.cmp thead th { font-weight: 500; vertical-align: bottom; }
table.cmp .muted { color: var(--muted); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-weight: 500; color: var(--ink); text-decoration: underline; text-decoration-color: var(--heat); cursor: pointer; }

/* ---- Small screens: map on top, profile below ---------------------------------------- */
@media (max-width: 900px) {
  .atlas-toolbar { grid-template-columns: 1fr; padding: .75rem; }
  .atlas-lenses { display: none; }
  .atlas-lens-select {
    display: block; width: 100%; font: 500 1rem var(--body); color: var(--ink);
    padding: .55rem .7rem; border: 1px solid var(--hairline); border-radius: 0; background: #fff;
  }
  .atlas-app { grid-template-columns: 1fr; height: auto; min-height: 0; }
  #atlas-map { height: 62vh; min-height: 380px; }
  .atlas-panel { border-left: 0; border-top: 1px solid var(--hairline); overflow: visible; scroll-margin-top: 70px; }
  .atlas-legend { min-width: 0; font-size: .72rem; padding: .5rem .6rem; }
  .atlas-legend .lg-note { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .lens-chip { transition: none; }
}

/* ---- Page bits ---------------------------------------------------------------------------- */
.hero .hero-lede { font-family: var(--body); font-weight: 400; color: var(--muted); max-width: 64ch; margin: 0 0 .9rem; }
.atlas-foot { margin: 1.2rem 0 2.5rem; color: var(--muted); font-size: .95rem; }
.atlas-foot a, .table-intro a { color: var(--ink); text-decoration-color: var(--heat); }
.table-intro { max-width: 70ch; color: var(--muted); }
.table-filter { display: flex; align-items: center; gap: .6rem; margin: 1rem 0; }
.table-filter label { font-family: var(--label); font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.table-filter input { font: 400 1rem var(--body); padding: .45rem .7rem; border: 1px solid var(--ink); border-radius: 0; min-width: 240px; }
table.nbhd-table thead th { white-space: nowrap; }
table.nbhd-table tbody th a { color: var(--ink); text-decoration-color: var(--heat); font-weight: 500; }
/* The map is the point of this page: keep the title to ~2 lines so the map
   starts above the fold on a laptop screen. */
.hero .hero-title { font-size: clamp(2.1rem, 1.5rem + 2.4vw, 3.4rem); max-width: 22ch; }
.hero { padding-top: clamp(1rem, 2.5vw, 1.8rem); }
