/* Tesla tunnels map: shared styles (embed + full page). */
:root { --ink:#1d1d1f; --muted:#5b5b60; --line:#e3ded6; --bg:#fbf9f6; --accent:#bf5a3c; --focus:#1f6fb2;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif; color: var(--ink); }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.tt-map { background: #e9eef1; }
.tt-error { margin: 0; padding: 8px 12px; background: #fde8e4; color: #8a1f0a; font-size: 14px; }

/* Filter chips */
.tt-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.tt-filter { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; min-height: 32px; border-radius: 999px;
  border: 1.5px solid var(--c); background: #fff; font-size: 13px; line-height: 1.1; white-space: nowrap; }
.tt-filter .tt-sw, .tt-sw { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; display: inline-block; }
.tt-filter .tt-count { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.tt-filter[aria-pressed="false"] { border-color: #c9c4bc; color: #8a8a8f; background: #f1eee9; text-decoration: line-through; }
.tt-filter[aria-pressed="false"] .tt-sw { background: transparent; box-shadow: inset 0 0 0 1.5px #b5b0a8; }
.tt-regions { display: flex; flex-wrap: wrap; gap: 6px; }
/* muted basemap so status colors read clearly */
.tt-tiles { filter: grayscale(.85) contrast(.9) brightness(1.06); }
.tt-region { white-space: nowrap; padding: 5px 10px; min-height: 32px; border-radius: 6px; border: 1px solid var(--line); background: #fff; font-size: 13px; }
.tt-region:hover, .tt-filter:hover { box-shadow: 0 1px 3px rgba(0,0,0,.15); }

/* Popups */
.tt-pop h3 { margin: 0 0 4px; font-size: 15px; line-height: 1.25; }
.tt-pop p { margin: 4px 0; font-size: 13px; line-height: 1.35; }
.tt-proj { color: var(--muted); }
.tt-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--c); color: #fff; font-size: 12px; font-weight: 600; }
.tt-prec { font-size: 12px; color: var(--muted); }
.tt-note { font-size: 12px !important; color: #444; background: #f6f3ee; padding: 4px 6px; border-radius: 4px; }
.tt-src { font-size: 12px !important; color: #444; word-break: break-word; }
.tt-links { margin: 2px 0 0; padding-left: 18px; font-size: 12.5px; }
.tt-links a { color: var(--focus); }
.leaflet-container { font: inherit; }
.leaflet-container a.leaflet-popup-close-button { width: 28px; height: 28px; font-size: 22px; line-height: 28px; }
.leaflet-control-attribution { font-size: 10.5px; }

/* Touch lock button (embed on touch devices) */
.tt-interact { background: #fff; border: 2px solid rgba(0,0,0,.25); border-radius: 6px; padding: 6px 10px; font-size: 13px; font-weight: 600; min-height: 36px; }
.tt-interact[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Embed ---------- */
.tt-embed { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: #fff; }
.tt-embed .tt-bar { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-bottom: 1px solid var(--line); }
.tt-embed .tt-filters, .tt-embed .tt-regions { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.tt-embed .tt-map { flex: 1 1 auto; min-height: 200px; }
.tt-embed .tt-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 6px 10px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.tt-embed .tt-foot .tt-precision { flex: 1 1 260px; margin: 0; }
.tt-embed .tt-key { white-space: nowrap; }
.tt-embed .tt-key svg { vertical-align: middle; }
.tt-fulllink { color: var(--accent); font-weight: 600; white-space: nowrap; }
@media (min-width: 1000px) {
  .tt-embed .tt-bar { flex-direction: row; align-items: center; justify-content: space-between; }
}
@media (max-width: 520px) {
  .tt-embed .tt-filters { flex-wrap: wrap; overflow: visible; gap: 4px; }
  .tt-embed .tt-filter { min-height: 28px; padding: 3px 8px; font-size: 12px; gap: 4px; }
  .tt-embed .tt-filter .tt-count { display: none; }
  .tt-embed .tt-region { min-height: 28px; padding: 3px 8px; font-size: 12px; }
  .tt-embed .tt-bar { padding: 6px; gap: 4px; }
  .tt-embed .tt-foot { font-size: 11px; padding: 4px 8px; }
}

/* ---------- Full page ---------- */
.tt-skip { position: absolute; left: -999px; top: 0; background: #fff; padding: 8px; z-index: 2000; }
.tt-skip:focus { left: 8px; }
.tt-full .tt-head { padding: 14px 18px 10px; border-bottom: 1px solid var(--line); background: #fff; }
.tt-full h1 { margin: 0; font-size: 22px; }
.tt-sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.tt-layout { display: flex; height: calc(100vh - 78px); height: calc(100dvh - 78px); }
.tt-side { width: 360px; flex: none; overflow-y: auto; padding: 12px 14px 24px; border-right: 1px solid var(--line); background: var(--bg); }
.tt-main { flex: 1; position: relative; }
.tt-full .tt-map { position: absolute; inset: 0; }
.tt-h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 6px; }
.tt-precision { font-size: 13px; line-height: 1.4; }
.tt-side .tt-precision { margin: 0; padding: 8px 10px; background: #fff4e5; border-left: 3px solid var(--accent); border-radius: 4px; }
.tt-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin-top: 10px; font-size: 12.5px; color: #333; }
.tt-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tt-group { margin-bottom: 10px; }
.tt-group-h { display: flex; align-items: center; gap: 6px; font-size: 14px; margin: 10px 0 4px; }
.tt-list ul { list-style: none; margin: 0; padding: 0; }
.tt-item { display: block; width: 100%; text-align: left; padding: 7px 9px; margin: 2px 0; border: 1px solid transparent; border-radius: 6px; background: transparent; }
.tt-item:hover { background: #fff; border-color: var(--line); }
.tt-item[aria-current="true"] { background: #fff; border-color: var(--accent); }
.tt-item-name { display: block; font-size: 14px; font-weight: 600; }
.tt-item-city { display: block; font-size: 12px; color: var(--muted); }
.tt-flag { display: inline-block; margin-top: 3px; padding: 0 6px; border-radius: 4px; font-size: 11px; background: #eceae6; color: #444; }
.tt-flag-none { background: #fde8e4; color: #8a1f0a; }
.tt-detail { margin-top: 14px; padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.tt-detail h3 { margin: 0 0 6px; font-size: 15px; }
.tt-detail dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 10px; margin: 6px 0; }
.tt-detail dt { color: var(--muted); }
.tt-detail dd { margin: 0; }
.tt-notes { color: #333; line-height: 1.4; }
@media (max-width: 760px) {
  .tt-layout { flex-direction: column-reverse; height: auto; }
  .tt-main { height: 60vh; min-height: 320px; }
  .tt-side { width: auto; border-right: 0; overflow: visible; }
}
