/* The map's navigation (owner, 2026-11-22: "Let's do the mixed"; static/js/map_nav.js, docs/31 §6): one floating
   bar for the search and the chips, typed results in tabs under it, and the sheet's Sites | Companies switch with
   its quiet sort. Linked in the head of home_map.html, so the bar is drawn in its final shape at first paint.
   Tokens are the site's own (styles.css). */

/* ---- one search on this page: the top bar's site search gives way to the map's ---- */
body[data-page="map"] .top-bar .site-search,
body[data-page="map"] .top-bar .search-toggle { display: none; }

/* ---- the bar: the search, then the picked company and place, then the chips ---- */
.map-landing .map-float {
  right: auto; max-width: calc(100% - 2 * var(--landing-inset) - 4rem); padding: 4px; gap: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-float); /* taste-skill-ignore: the bar floats over the map */
  pointer-events: auto;
}
.map-landing .map-search { flex: 0 0 17rem; min-width: 0; }
.map-landing .map-search__input { border: 0; border-radius: 8px; background: var(--bg); min-height: 2.5rem; }
.map-landing .fchip { border-color: transparent; height: 2.5rem; }
.map-landing .fchip:hover { border-color: var(--border); transform: none; }
.map-landing .fchip[data-on], .map-landing .fchip--split[data-on] { background: var(--active); color: var(--text); }
.map-landing .fchip--split .fchip__body, .map-landing .fchip--split .fchip__arrow { border-color: transparent; }
.map-landing .map-chiprow { border-left: 1px solid var(--border); padding-left: 4px; } /* taste-skill-ignore: app screen (app-screens §13), the toolbar's one divider between search and filters */
/* A picked company is the bar's first chip; Owner gives way to it. */
.map-landing #map-highlight:not([hidden]) ~ .map-chiprow .fchip[data-chip="owner"] { display: none; }

/* ---- typed results: the panel spans the bar (`--bar-w`, set by map_nav.js when the bar resizes) ---- */
.map-landing .map-search__list {
  left: -5px; top: calc(100% + 10px); width: min(var(--bar-w, 44rem), 45rem); max-width: none; max-height: min(70vh, 34rem);
  padding: 0 0 var(--space-1); border-radius: 12px;
}
.map-landing .map-search__list[hidden] { display: none; }
.map-nav__tabs {
  position: sticky; top: 0; z-index: 1; display: flex; gap: var(--space-1); padding: 6px var(--space-2) 0;
  background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; /* taste-skill-ignore: the tab track (app-screens §13) */
}
.map-nav__tabs[hidden] { display: none; }
.map-nav__tabs button {
  flex: none; height: 2.25rem; margin-bottom: -1px; padding: 0 var(--space-2); border: 0; border-bottom: 2px solid transparent;
  background: none; font: inherit; font-size: var(--text-label); color: var(--text-muted); cursor: pointer;
}
.map-nav__tabs button span { margin-inline-start: 2px; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.map-nav__tabs button[aria-selected="true"] { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }
.map-nav__group + .map-nav__group { margin-top: var(--space-1); }
.map-nav__group-h { padding: var(--space-2) var(--space-3) 2px; font-size: var(--text-label); font-weight: 500; color: var(--text-muted); }
.map-nav__opt {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) auto auto; align-items: center; column-gap: var(--space-3);
  min-height: 2.75rem; padding: 4px var(--space-3); cursor: pointer;
}
.map-nav__opt.is-active { background: var(--active); }
.map-nav__body { display: flex; flex-direction: column; min-width: 0; }
.map-nav__label { font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-nav__label b { font-weight: 700; }
.map-nav__detail { font-size: var(--text-1); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-nav__detail .chip { padding: 0 var(--space-1); margin-inline-end: 2px; }
.map-nav__act { font-size: var(--text-1); color: var(--text-muted); visibility: hidden; }
.map-nav__opt.is-active .map-nav__act { visibility: visible; color: var(--text); }
.map-nav__opt:is([data-kind="companies"], [data-kind="everything"]) .map-nav__label { color: var(--link); }
/* Each type's mark in the map's own grammar: a project a ring, a plant a disc, an asset a diamond, a place a pin,
   a company a square, an RFP the demand side's square in copper, a filter two bars. */
.map-nav__glyph { justify-self: center; width: 10px; height: 10px; box-sizing: border-box; }
.map-nav__glyph--project { border: 2px solid var(--text); border-radius: 50%; }
.map-nav__glyph--plant { background: var(--text); border-radius: 50%; }
.map-nav__glyph--asset { background: var(--text-muted); transform: rotate(45deg) scale(0.85); }
.map-nav__glyph--state, .map-nav__glyph--county, .map-nav__glyph--region, .map-nav__glyph--grid {
  border: 2px solid var(--text-muted); border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
}
.map-nav__glyph--rfp { background: var(--color-copper); border-radius: 2px; }
.map-nav__glyph--filter, .map-nav__glyph--question { height: 8px; border-top: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); }
.map-nav__glyph--company { border: 2px solid var(--text); border-radius: 2px; }
.map-nav__glyph--companies, .map-nav__glyph--everything { width: 12px; height: 2px; background: var(--link); }
.map-nav__due { font-size: var(--text-1); font-variant-numeric: tabular-nums; color: var(--text-muted); }
.map-nav__due--soon { color: var(--color-copper); font-weight: 600; }
.map-nav__more {
  display: block; width: 100%; padding: 6px var(--space-3) 8px calc(20px + 2 * var(--space-3)); text-align: left;
  border: 0; background: none; font: inherit; font-size: var(--text-1); color: var(--link); cursor: pointer;
}

/* ---- the sheet's switch and its quiet sort ---- */
.map-nav-sort { position: relative; display: flex; align-items: center; gap: var(--space-2); }
.map-nav-sort--phone { display: none; }
/* From 720px: the panel's first line, the switch at the left, the sort at the right, over the table. */
.map-nav-sort--wide { box-sizing: border-box; justify-content: space-between; height: 2.5rem; padding: 2px var(--space-4); }
/* The desktop peek holds that line too and stays under a quarter of the map at 900px tall (owner, 2026-11-02): the
   band, the line, the table's head and one whole row, 88 + 40 + 36 + 36 + 1 = 201px (styles.css, "the list's peek
   from 720px": 197px, two rows, before the line). */
@media (min-width: 720px) and (min-height: 37.51rem) {
  .map-landing { --sheet-closed: 201px; }
  .map-landing[data-sheet="closed"] .map-key__body {
    max-height: calc(100vh - var(--top-bar-h) - 201px - 2 * var(--landing-inset) - 19rem);
    max-height: calc(100dvh - var(--top-bar-h) - 201px - 2 * var(--landing-inset) - 19rem);
  }
}

.map-landing[data-list="list"] .map-nav-sort { display: none !important; }
.map-nav-seg { display: inline-flex; padding: 2px; border-radius: var(--radius-2); background: var(--active); }
.map-nav-seg button {
  height: 2rem; padding: 0 var(--space-3); border: 0; border-radius: 4px; background: none;
  font: inherit; font-size: var(--text-label); color: var(--text-muted); cursor: pointer;
}
.map-nav-seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; }
.map-nav-sortbtn {
  display: inline-flex; align-items: center; gap: 6px; height: 2.25rem; padding: 0 var(--space-2);
  border: 0; border-radius: var(--radius-2); background: none; color: var(--text);
  font: inherit; font-size: var(--text-label); white-space: nowrap; cursor: pointer;
}
.map-nav-sortbtn:hover { background: var(--active); }
.map-nav-sortbtn:disabled { color: var(--text-muted); cursor: default; background: none; }
.map-nav-sortbtn:disabled svg { display: none; }
.map-nav-sortmenu {
  position: fixed; z-index: 40; min-width: 12rem; padding: 4px 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-2); box-shadow: var(--shadow-float); /* taste-skill-ignore: a menu over the sheet */
}
.map-nav-sortmenu[hidden] { display: none; }
.map-nav-sortmenu button {
  display: flex; align-items: center; width: 100%; min-height: 2.25rem; padding: 0 var(--space-3); border: 0; background: none;
  font: inherit; font-size: var(--text-label); color: var(--text); text-align: left; cursor: pointer;
}
.map-nav-sortmenu button:hover, .map-nav-sortmenu button:focus { background: var(--active); outline: none; }
.map-nav-sortmenu button[aria-checked="true"] { font-weight: 600; }
.map-nav-sortmenu button[aria-checked="true"]::after {
  content: ""; width: 8px; height: 4px; margin-inline-start: auto; border-left: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: translateY(-2px) rotate(-45deg);
}

/* ---- companies in this view ---- */
.map-landing[data-navlist="companies"] :is(#ruler-table, #ruler-strip, #ruler-tools, #ruler-gen, #ruler-rfp, #ruler-must) { display: none !important; }
.map-companies[hidden] { display: none; }
.map-companies__head { display: flex; align-items: center; min-height: 2.5rem; padding: 0 var(--space-4); }
.map-companies__title { font-size: var(--text-label); font-weight: 600; color: var(--text); }
.map-companies__rows { list-style: none; margin: 0; padding: 0 var(--space-4); }
.map-companies__row {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 6rem auto; align-items: center; column-gap: var(--space-3);
  min-height: 3.25rem; border-bottom: 1px solid var(--rule); isolation: isolate; /* taste-skill-ignore: a list row rule (app-screens §13) */
}
/* The row's fill is its bar: the company's megawatts in view against the largest. */
.map-companies__row::before {
  content: ""; position: absolute; left: calc(-1 * var(--space-2)); top: 6px; bottom: 6px; z-index: -1; width: var(--w, 0%);
  background: color-mix(in srgb, var(--active) 55%, transparent); border-radius: 6px;
}
.map-companies__body { display: flex; flex-direction: column; min-width: 0; }
.map-companies__name { font-weight: 600; color: var(--text); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-companies__name:hover { text-decoration: underline; }
.map-companies__sub { font-size: var(--text-1); color: var(--text-muted); }
.map-companies__mw { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.map-companies__show {
  height: 2rem; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-2);
  background: var(--active); font: inherit; font-size: var(--text-label); color: var(--text); cursor: pointer;
}
.map-companies__note { padding: var(--space-4); color: var(--text-muted); }
.map-companies__credit { margin: 0; padding: var(--space-2) var(--space-4) var(--space-4); font-size: var(--text-1); color: var(--text-muted); }

/* ---- phone ---- */
@media (max-width: 719px) {
  .map-landing .map-search__list { left: 0; width: 100%; max-height: 62dvh; }
  .map-nav__act { display: none; }
  /* The bar wraps to the search over its chips, and stays up over the half sheet. */
  .map-landing .map-float {
    left: var(--space-4); right: var(--space-4); max-width: none; flex-wrap: wrap; box-shadow: 0 1px 3px rgba(11, 16, 35, 0.12); /* taste-skill-ignore: the bar floats over the map */
  }
  .map-landing .map-search { flex: 1 1 100%; }
  /* The chips scroll sideways inside the bar: they start 16px in from the screen's edge and a fade at the row's
     right end says there is more (`data-scrolled`, `data-end`, map_nav.js). */
  .map-landing .map-chiprow {
    display: flex !important; flex: 1 1 100%; min-width: 0; max-width: 100%; overflow-x: auto; border-left: 0; padding-left: 0;
    scroll-padding-inline: 0;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); /* taste-skill-ignore: the fade that says the chips scroll (a mask, not a fill) */
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); /* taste-skill-ignore: as above */
  }
  .map-landing .map-chiprow[data-end] { -webkit-mask-image: none; mask-image: none; }
  .map-landing[data-nav-open] .map-chiprow { display: none !important; }
  /* The switch and the sort take the old Name | Size line, start over at its right end. */
  .map-nav-sort--wide { display: none !important; }
  .map-landing .map-nav-sort--phone {
    order: 10; display: flex; justify-content: space-between; flex: none; box-sizing: border-box;
    width: calc(100% + var(--space-1) + var(--space-2)); margin: 0 calc(-1 * var(--space-2)) 0 calc(-1 * var(--space-1));
    min-height: 2.5rem; padding: 0 calc(2.75rem + 5px + 8px) 0 8px; border-bottom: 1px solid var(--border); background: var(--surface); /* taste-skill-ignore: the sheet band's rule, as styles.css draws it */
  }
  .map-nav-seg button { height: 2.25rem; }
  .map-companies__head { padding: 0 var(--space-3); }
  .map-companies__rows { padding: 0 var(--space-3); }
  .map-companies__row { grid-template-columns: minmax(0, 1fr) auto; }
  .map-companies__show { display: none; }
}
