/* AI map — Past the Pilot. Uses only the four core colours plus the kit's
   hairline colours. Fonts are the site's own self-hosted Manrope and Plex Mono. */

/* Loaded after /styles.css: fonts, colour tokens, header and theme switching
   come from the site. This file only adds what the map page needs. */

:root { --fg: var(--text); --accent: var(--link); --rule: #C7BED5; --surface: #FFFFFF; --sheet-w: 400px; }
:root[data-theme="dark"] { --rule: #5B456D; --surface: #110F17; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) { --rule: #5B456D; --surface: #110F17; } }

/* The map fills the first screen; "About this map" and the site footer follow
   below it. A strip of the next section stays visible, so the page can always
   be scrolled even though the map itself takes the scroll wheel. */
body { line-height: 1.45; }
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.02em; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -40px; z-index: 10; background: var(--bg); padding: 8px; }
.skip:focus { top: 8px; }

/* Header: the site's header, compacted for a full-screen map */
.map-header { padding: 0.6rem 0; border-bottom: 1px solid var(--rule); }
.map-header__inner { width: auto; margin: 0; padding-inline: 1rem; flex-wrap: nowrap; }
.map-header__kicker { margin-right: auto; margin-left: 0.5rem; }
.map-header__beta { border: 1px solid var(--rule); padding: 0 6px; border-radius: 999px; margin-left: 4px; }
.map-header .theme-toggle { min-height: 2.25rem; }
@media (max-width: 640px) { .map-header__kicker { display: none; } .map-header .site-nav a[aria-current="page"] { display: none; } }

/* Layout */
.layout {
  position: relative; display: grid; grid-template-columns: var(--sheet-w) 1fr;
  height: calc(100vh - 3.6rem - 2.75rem); height: calc(100svh - 3.6rem - 2.75rem); min-height: 460px;
  border-bottom: 1px solid var(--rule);
}
.mapwrap { position: relative; min-height: 0; }
.map { position: absolute; inset: 0; }

/* Panel */
.sheet { min-height: 0; border-right: 1px solid var(--rule); background: var(--bg); display: flex; flex-direction: column; }
.sheet__handle { display: none; }
.sheet__body { overflow-y: auto; padding: 20px 20px 16px; display: flex; flex-direction: column; gap: 0; min-height: 0; flex: 1; }
.sheet__title { font-weight: 560; font-size: 26px; line-height: 1.1; margin: 0 0 8px; }
.sheet__intro { margin: 0 0 16px; }
.sheet__foot { margin-top: auto; padding-top: 24px; display: grid; gap: 10px; }
.sheet__foot .mono { font-size: 12px; margin: 0; }
.sheet__foot .credit img { width: 160px; }
.map-links { font-size: 14px; }
.basemap-note { position: absolute; left: 12px; bottom: 40px; z-index: 2; margin: 0; padding: 4px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--rule); font-size: 12px; }

.search input {
  width: 100%; font: inherit; color: var(--fg); background: var(--surface);
  border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
.chips { border: 0; padding: 0; margin: 16px 0 0; }
.chips legend { padding: 0; margin-bottom: 8px; }
.chips__row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 14px; color: var(--fg); background: transparent; cursor: pointer;
  border: 1px solid var(--rule); border-radius: 999px; padding: 6px 12px; min-height: 36px;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.chip__n { font-family: "IBM Plex Mono", monospace; font-size: 12px; opacity: 0.8; }
.chip:disabled { opacity: 0.45; cursor: not-allowed; }
.chips__legend { display: flex; width: 100%; align-items: baseline; justify-content: space-between; }
.chips__bulk { display: inline-flex; gap: 14px; font-size: 14px; }
.chips__hint { margin: 8px 0 0; font-size: 13px; opacity: 0.8; white-space: pre-line; }
.linkish { all: unset; cursor: pointer; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.linkish:disabled { color: var(--fg); opacity: 0.4; text-decoration: none; cursor: default; }
.linkish:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.results__empty { padding: 16px 0; }
/* AI in practice: dashed ring so these read differently from AI-native companies. */
.disc--practice { border: 1.5px dashed var(--purple) !important; }
.toggles { margin: 14px 0 0; display: grid; gap: 8px; }
.switch { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--purple); }
.count { margin: 18px 0 6px; }

.results { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.results li { border-bottom: 1px solid var(--rule); }
.result {
  all: unset; box-sizing: border-box; display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: center;
  width: 100%; padding: 10px 2px; cursor: pointer;
}
.result:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.result:hover .result__name { text-decoration: underline; }
.result__name { font-weight: 560; display: block; }
.result__meta { display: block; font-size: 12px; }

/* Logo discs (list, card and map markers share these) */
.disc {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  background: #FFFFFF; border: 1px solid var(--rule); color: var(--black);
  font-weight: 560; font-size: 14px; letter-spacing: -0.01em; flex: none;
}
.disc img { width: 100%; height: 100%; object-fit: cover; }
.disc--mark img { width: 70%; height: 70%; object-fit: contain; }
.disc--mono { background: var(--purple); color: var(--paper); border-color: var(--purple); }

/* Detail card */
.back { all: unset; cursor: pointer; color: var(--accent); margin-bottom: 14px; display: inline-block; padding: 6px 0; }
.back:focus-visible { outline: 2px solid var(--accent); }
.card__head { display: grid; grid-template-columns: 56px 1fr; gap: 14px; align-items: center; }
.card__head .disc { width: 56px; height: 56px; font-size: 18px; }
.card__type { margin: 0 0 4px; }
.card__name { font-weight: 560; font-size: 24px; line-height: 1.15; margin: 0; }
.card__desc { margin: 16px 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 14px 0 0; padding: 0; }
.tag {
  font-family: "IBM Plex Mono", monospace; font-size: 12px; line-height: 1.3;
  padding: 4px 10px; border: 1px solid var(--rule); border-radius: 999px;
}
.tag--native { background: var(--purple); border-color: var(--purple); color: var(--paper); }
.tag--practice { border: 1.5px dashed var(--purple); }
.card__where { margin: 0 0 16px; }
.card__photo { margin: 0 0 16px; border-radius: 12px; overflow: hidden; border: 1px solid var(--rule); }
.card__photo img { display: block; width: 100%; height: auto; }
.card__photo figcaption { font-size: 12px; padding: 6px 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 560;
  background: var(--purple); color: var(--paper); padding: 10px 16px; border-radius: 999px; min-height: 44px;
}
.btn:visited { color: var(--paper); }
.btn--ghost, .btn--ghost:visited { background: transparent; color: var(--fg); border: 1px solid var(--rule); font-weight: 450; }
.card__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.card h3 { font-family: "IBM Plex Mono", monospace; font-weight: 400; font-size: 12.5px; text-transform: uppercase; margin: 18px 0 8px; }
.rel { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.rel li { border-bottom: 1px solid var(--rule); padding: 10px 0; }
.rel button { all: unset; cursor: pointer; font-weight: 560; color: var(--accent); }
.rel button:focus-visible { outline: 2px solid var(--accent); }
.rel p { margin: 2px 0 0; font-size: 14px; }
.card__meta { margin-top: 18px; font-size: 12px; }
.card__meta a { color: inherit; }

/* Map controls */
.mapctl { position: absolute; top: 12px; right: 12px; display: flex; gap: 6px; z-index: 2; flex-wrap: wrap; justify-content: flex-end; }
.mapctl button {
  font: inherit; font-size: 14px; cursor: pointer; color: var(--fg); background: var(--bg);
  border: 1px solid var(--rule); border-radius: 999px; padding: 6px 12px; min-height: 36px;
}
.mapctl button[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.maplibregl-ctrl-group { background: var(--bg) !important; border: 1px solid var(--rule); box-shadow: none !important; }
.maplibregl-ctrl-group button + button { border-top-color: var(--rule) !important; }
:root[data-theme="dark"] .maplibregl-ctrl-icon { filter: invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .maplibregl-ctrl-icon { filter: invert(1); } }
.maplibregl-ctrl-attrib { background: color-mix(in srgb, var(--bg) 85%, transparent) !important; color: var(--fg); font-size: 11px; }
.maplibregl-ctrl-attrib a { color: var(--fg) !important; }

/* Markers. "all: unset" below would also remove MapLibre's absolute
   positioning, so it is restored here for every marker element. */
.maplibregl-marker.mk, .maplibregl-marker.mk-cluster, .maplibregl-marker.mk-areawrap { position: absolute; top: 0; left: 0; }
.maplibregl-marker.mk-areawrap.is-open { z-index: 20; }

/* List that unfolds below a "no street address" pill */
.mk-menu {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  width: 280px; max-height: min(320px, 50vh); overflow: auto; overscroll-behavior: contain;
  margin: 0; padding: 6px; list-style: none;
  background: var(--bg); color: var(--fg); border: 1px solid var(--rule); border-radius: 12px;
  box-shadow: 0 8px 24px rgb(8 7 11 / 0.18);
}
.mk-menu--up { top: auto; bottom: calc(100% + 6px); }
.mk-menu[hidden] { display: none; }
.mk-menu__item {
  all: unset; box-sizing: border-box; cursor: pointer; width: 100%;
  display: grid; grid-template-columns: 32px 1fr; gap: 10px; align-items: center;
  padding: 6px 8px; border-radius: 8px; text-align: left;
}
.mk-menu__item:hover { background: var(--surface); }
.mk-menu__item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.mk-menu__item .disc { width: 32px; height: 32px; font-size: 11px; }
.mk-menu__name { display: block; font-weight: 560; font-size: 14px; line-height: 1.25; }
.mk-menu__meta { display: block; font-size: 11px; line-height: 1.3; margin-top: 2px; }
.mk { all: unset; cursor: pointer; display: block; border-radius: 50%; }
/* The ring takes the text colour (dark on the light map, light on the dark map) so markers stand out from the land. */
.mk .disc { width: 44px; height: 44px; box-shadow: 0 0 0 2px var(--fg); }
.mk:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.mk[aria-current="true"] .disc { box-shadow: 0 0 0 2px var(--fg), 0 0 0 5px var(--purple); }
.mk--dim { opacity: 0.35; }
.mk-cluster {
  all: unset; cursor: pointer; display: grid; place-items: center; border-radius: 50%;
  background: var(--purple); color: var(--paper); font-weight: 560; font-size: 16px; box-shadow: 0 0 0 2px var(--fg);
}
.mk-cluster:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.mk-area {
  all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px;
  background: var(--bg); color: var(--fg); border: 1.5px dashed var(--purple); border-radius: 999px; font-size: 14px; white-space: nowrap;
}
.mk-area__n { background: var(--purple); color: var(--paper); border-radius: 999px; min-width: 28px; height: 28px; display: grid; place-items: center; font-weight: 560; }
.is-far .mk-area__t { display: none; }
.is-far .mk-area { padding: 3px; }
.mk-area:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.mk-label {
  position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%); white-space: nowrap; pointer-events: none;
  font-size: 12px; font-weight: 560; background: var(--bg); color: var(--fg); padding: 1px 6px; border-radius: 6px; opacity: 0;
}
.mk:hover .mk-label, .mk:focus-visible .mk-label, .mk-label.is-shown { opacity: 1; }
.mk:hover, .mk:focus-visible { z-index: 5; }

/* Hover entrance only when motion is welcome */
@media (prefers-reduced-motion: no-preference) {
  .mk .disc { transition: transform 150ms ease; }
  .mk:hover .disc { transform: scale(1.08); }
}

.noscript { position: absolute; inset: 16px; }

/* Phones: sheet becomes a bottom sheet over the map */
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; height: calc(100svh - 3.6rem - 4.5rem); min-height: 420px; }
  .mapwrap { position: absolute; inset: 0; }
  .sheet {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; border-right: 0;
    border-top: 1px solid var(--rule); border-radius: 16px 16px 0 0; max-height: 34%;
    box-shadow: 0 -8px 24px rgb(8 7 11 / 0.12);
  }
  .sheet[data-open="true"] { max-height: 82%; }
  @media (prefers-reduced-motion: no-preference) { .sheet { transition: max-height 220ms ease; } }
  .sheet__handle {
    all: unset; display: grid; justify-items: center; gap: 4px; padding: 8px 0 4px; cursor: pointer; width: 100%;
  }
  .sheet__handle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  .sheet__handle-bar { width: 40px; height: 4px; border-radius: 4px; background: var(--rule); }
  .sheet__handle-text { font-family: "IBM Plex Mono", monospace; font-size: 12px; text-transform: uppercase; }
  .sheet__body { padding: 8px 16px 16px; }
  .sheet__title { font-size: 22px; }
  .mapctl { top: 8px; right: 8px; }
}

/* About this map + site footer below the map */
.map-about { padding-top: 3.5rem; }
.map-about h2 { font-size: clamp(1.75rem, 3.4vw, 2.6rem); max-width: 16em; }
.map-about__grid { display: grid; gap: 1.75rem; margin-top: 2rem; }
.map-about h3 { font-weight: 560; font-size: 1.15rem; margin: 0 0 0.5rem; }
.map-about__grid p { margin: 0; max-width: 42ch; }
.map-about__cta { margin-top: 2.25rem; }
.map-about__sources { margin-top: 1.5rem; font-size: 0.85rem; }
@media (min-width: 800px) { .map-about__grid { grid-template-columns: repeat(3, 1fr); gap: 2.5rem; } }
