/* LinkYiwu Wayfinder — inherits the Lance theme tokens, with fallbacks for other themes. */
.ylw {
	--ylw-accent: var(--lance-red, #f51622);
	--ylw-selected-floor: #bee8ef;
	--ylw-ink: var(--lance-text, #11120f);
	--ylw-muted: var(--lance-muted, #5a5a5a);
	--ylw-ground: var(--lance-bg, #faf9f5);
	--ylw-card: var(--lance-card, #fffefb);
	--ylw-line: var(--lance-card-line, #e7e3dc);
	--ylw-chip: #f1eee7;
	--ylw-soft: #fff1f0;
	--ylw-soft-line: #f7c1bd;
	/* Gate plates imitate market signage: dark plate, white number. That reads on
	   either ground, so this one stays put instead of following the theme — on a
	   dark card a plate the colour of the card would stop looking like a plate. */
	--ylw-plate: #11120f;
	--ylw-building: #fbfaf7;
	--ylw-wall: #ded8cc;
	--ylw-glazing: #ccdce6;
	--ylw-edge: #6f6a60;
	--ylw-sans: var(--lance-sans, "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
	--ylw-serif: var(--lance-serif, "Libre Baskerville", Georgia, serif);
	--ylw-label: var(--lance-label, "IBM Plex Sans", system-ui, sans-serif);

	display: grid;
	grid-template-columns: minmax(270px, 320px) 1fr;
	gap: 16px;
	height: var(--ylw-h, 760px);
	margin-block: 24px;
	color: var(--ylw-ink);
	font: 15px/1.5 var(--ylw-sans);
	text-align: left;
}

/* Dark mode. The tokens above that point at Lance variables follow the theme on
   their own; these three were literals picked for a light card, so they have to
   be restated. Written twice — once behind the system preference, once behind
   the explicit choice on <html> — to match how the theme does it, which keeps
   dark mode working with JavaScript off. */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .ylw {
		--ylw-chip: var(--lance-surface, #23261f);
		--ylw-soft: var(--lance-blush, #33211f);
		--ylw-soft-line: rgba(217, 15, 25, .38);
	}
}
:root[data-theme="dark"] .ylw {
	--ylw-chip: var(--lance-surface, #23261f);
	--ylw-soft: var(--lance-blush, #33211f);
	--ylw-soft-line: rgba(217, 15, 25, .38);
}

.ylw *, .ylw *::before, .ylw *::after { box-sizing: border-box; }
/* Components below set display:flex/grid, which would otherwise beat the UA rule for [hidden]. */
.ylw [hidden] { display: none !important; }
/* :where() keeps this reset at element specificity so component classes (.ylw-dl, .ylw-plate…) win. */
:where(.ylw) button { font: inherit; color: inherit; }
.ylw :focus-visible { outline: 2px solid var(--ylw-accent); outline-offset: 2px; }

/* ---------- sidebar ---------- */
.ylw-side {
	display: flex; flex-direction: column; min-height: 0; overflow: hidden;
	background: var(--ylw-card); border: 1px solid var(--ylw-line); border-radius: 12px;
}
.ylw-head { display: grid; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--ylw-line); }
.ylw-brand {
	display: flex; justify-content: space-between; align-items: baseline;
	font: 500 12px/1 var(--ylw-label); letter-spacing: .12em; text-transform: uppercase; color: var(--ylw-muted);
}
.ylw-brand b { color: var(--ylw-accent); font-weight: 700; }
.ylw-search { position: relative; }
.ylw-search svg { position: absolute; left: 12px; top: 13px; width: 18px; height: 18px; stroke: var(--ylw-muted); }
.ylw-q {
	width: 100%; height: 44px; margin: 0; padding: 0 12px 0 38px;
	border: 1px solid var(--ylw-line); border-radius: 999px; background: var(--ylw-ground);
	color: var(--ylw-ink); font: 15px var(--ylw-sans);
}
.ylw-q::placeholder { color: var(--ylw-muted); }
.ylw-results { display: grid; gap: 2px; }
.ylw-results:empty { display: none; }
.ylw-result {
	display: flex; gap: 10px; align-items: center; width: 100%;
	padding: 8px 10px; border: 0; border-radius: 8px; background: none; text-align: left; cursor: pointer;
}
.ylw-result:hover, .ylw-result:focus-visible { background: var(--ylw-chip); }
.ylw-result small, .ylw-hint { color: var(--ylw-muted); font-size: 13px; }
.ylw-hint { padding: 6px 10px; margin: 0; }

.ylw-body { display: grid; gap: 18px; align-content: start; overflow: auto; padding: 16px 20px 20px; }
.ylw-loading { margin: 0; color: var(--ylw-muted); }
.ylw h3, .ylw h4 { margin: 0; text-wrap: balance; }
.ylw-title { font: 400 28px/1.1 var(--ylw-serif); letter-spacing: -.01em; }
.ylw-eyebrow { font: 500 12px/1 var(--ylw-label); letter-spacing: .12em; text-transform: uppercase; color: var(--ylw-muted); }
.ylw-lede { margin: 8px 0 0; color: var(--ylw-muted); max-width: 60ch; }
.ylw-crumb { justify-self: start; padding: 0; border: 0; background: none; color: var(--ylw-accent); font-weight: 700; cursor: pointer; }
.ylw-title-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; }
.ylw-zh { color: var(--ylw-muted); font-size: 16px; }
.ylw-meta { color: var(--ylw-muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }

/* district list */
.ylw-list { display: grid; border-top: 1px solid var(--ylw-line); }
.ylw-drow {
	display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center;
	width: 100%; padding: 11px 8px 11px 4px; border: 0; border-bottom: 1px solid var(--ylw-line);
	background: none; text-align: left; cursor: pointer;
}
.ylw-drow:hover { background: var(--ylw-chip); }
.ylw-drow[aria-current="true"] { background: var(--ylw-soft); }
.ylw-dbadge {
	display: grid; place-items: center; width: 34px; height: 34px;
	border: 1.5px solid var(--ylw-line); border-radius: 50%; font: 700 13px/1 var(--ylw-sans); font-variant-numeric: tabular-nums;
}
.ylw-drow[aria-current="true"] .ylw-dbadge { background: var(--ylw-accent); border-color: var(--ylw-accent); color: #fff; }
.ylw-dname { display: block; font-weight: 700; font-size: 14.5px; }
.ylw-dsub { display: block; color: var(--ylw-muted); font-size: 12.5px; }
.ylw-dchev { display: grid; place-items: center; width: 18px; height: 18px; color: var(--ylw-muted); }
.ylw-dchev svg { width: 18px; height: 18px; }
.ylw-drow[aria-current="true"] .ylw-dchev { color: var(--ylw-accent); }

/* selected district detail */
.ylw-detail { display: grid; gap: 12px; }
.ylw-detail:empty { display: none; }
.ylw-intro { display: grid; gap: 2px; }
.ylw-chiprow { display: flex; flex-wrap: wrap; gap: 6px; }
.ylw-chip {
	height: 30px; padding: 0 11px; border: 1px solid var(--ylw-line); border-radius: 999px; background: var(--ylw-card);
	font: 700 12.5px/1 var(--ylw-sans); font-variant-numeric: tabular-nums; cursor: pointer;
}
.ylw-chip:hover { background: var(--ylw-chip); }
.ylw-chip[aria-pressed="true"] { background: var(--ylw-accent); border-color: var(--ylw-accent); color: #fff; }
.ylw-helper { margin: 0; color: var(--ylw-muted); font-size: 12.5px; }
.ylw-helper:empty { display: none; }
.ylw-detail-actions { display: grid; gap: 8px; }
.ylw-btn.is-ghost { justify-content: center; }
.ylw-detail-actions .ylw-btn { justify-content: center; height: 40px; }
.ylw-gatelist { display: grid; border-top: 1px solid var(--ylw-line); }
.ylw-gaterow {
	display: flex; gap: 10px; align-items: center; width: 100%; padding: 10px 4px;
	border: 0; border-bottom: 1px solid var(--ylw-line); background: none; text-align: left; cursor: pointer;
}
.ylw-gaterow:hover { background: var(--ylw-chip); }
.ylw-gaterow span { color: var(--ylw-muted); font-size: 12.5px; }

/* gate plate */
.ylw-plate {
	display: inline-flex; align-items: baseline; gap: 3px; white-space: nowrap;
	padding: 4px 7px 3px; border: 1.5px solid var(--ylw-plate); border-radius: 4px;
	background: var(--ylw-plate); color: #fff; font: 700 14px/1 var(--ylw-sans); font-variant-numeric: tabular-nums;
}
.ylw-plate i { font-style: normal; font-weight: 500; font-size: 10px; opacity: .7; letter-spacing: .04em; }
.ylw-plate.is-tbd { background: var(--ylw-card); color: var(--ylw-ink); border-style: dashed; border-color: var(--ylw-muted); }
button.ylw-plate { cursor: pointer; }

/* focus + address cards */
.ylw-card { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--ylw-soft-line); border-radius: 10px; background: var(--ylw-soft); }
.ylw-card-top { display: flex; gap: 12px; align-items: center; }
.ylw-card .ylw-plate.is-big { font-size: 24px; padding: 7px 10px 6px; border-color: var(--ylw-accent); background: var(--ylw-accent); }
.ylw-card .ylw-plate.is-big i { font-size: 12px; }
.ylw-where { font: 700 17px/1.2 var(--ylw-sans); }
.ylw-card p { margin: 0; color: var(--ylw-muted); font-size: 13.5px; }
.ylw-addr { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ylw-addr li { padding: 3px 8px; border-radius: 999px; background: var(--ylw-card); border: 1px solid var(--ylw-line); font-size: 13px; font-variant-numeric: tabular-nums; }
.ylw-addr li.is-missing { border-style: dashed; color: var(--ylw-muted); }
.ylw-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ylw-btn {
	display: inline-flex; align-items: center; height: 34px; padding: 0 14px;
	border: 1px solid var(--ylw-line); border-radius: 999px; background: var(--ylw-card);
	color: var(--ylw-ink); font-weight: 700; font-size: 13.5px; text-decoration: none; cursor: pointer;
}
.ylw-btn.is-primary { background: var(--ylw-accent); border-color: var(--ylw-accent); color: #fff; }

/* floors */
.ylw-floors { display: grid; border-top: 1px solid var(--ylw-line); }
.ylw-floor {
	display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: start;
	width: 100%; padding: 10px 4px; border-bottom: 1px solid var(--ylw-line); text-align: left;
}
.ylw-lv {
	padding: 6px 0; border-radius: 6px; background: var(--ylw-chip); text-align: center;
	font: 700 12.5px/1 var(--ylw-sans); font-variant-numeric: tabular-nums;
}
.ylw-cats { font-size: 14px; }
.ylw-cats small { display: block; color: var(--ylw-muted); font-size: 12.5px; }
.ylw-gates { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.ylw-legend { display: grid; gap: 6px; color: var(--ylw-muted); font-size: 12.5px; }
.ylw-legend div { display: flex; gap: 8px; align-items: center; }
.ylw-legend .ylw-plate { font-size: 11px; padding: 2px 5px; }
.ylw-sources { margin: 0; color: var(--ylw-muted); font-size: 12px; line-height: 1.6; }
.ylw-sources a { color: inherit; }

/* ---------- stage ---------- */
/* The cartography is light in both modes, so everything floating over it — labels,
   leader lines, segmented control, menus, legend — keeps the light palette too.
   Pinning the tokens once here beats patching each overlay: in dark mode they
   would otherwise inherit light ink and sit on their own near-white surfaces. */
.ylw-stage {
	--ylw-ink: #11120f;
	--ylw-muted: #5a5a5a;
	--ylw-card: #fffefb;
	--ylw-line: #e7e3dc;
	--ylw-chip: #f1eee7;
	--ylw-soft: #fff1f0;
	--ylw-soft-line: #f7c1bd;

	position: relative; min-height: 0; overflow: hidden;
	border: 1px solid var(--ylw-line); border-radius: 12px; background: #eceae4;
	color: var(--ylw-ink);
}
.ylw-map { position: absolute; inset: 0; }
.ylw-error { position: absolute; inset: auto 16px 16px; margin: 0; padding: 12px 14px; border-radius: 8px; background: var(--ylw-card); border: 1px solid var(--ylw-line); }
.ylw-status {
	position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: min(360px, calc(100% - 32px));
	padding: 10px 16px; border-radius: 999px; background: var(--ylw-card); border: 1px solid var(--ylw-line);
	color: var(--ylw-muted); font-size: 13.5px; text-align: center;
}
.ylw-stage.is-ready .ylw-status { display: none; }
.ylw-labels { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.ylw-lbl { position: absolute; left: 0; top: 0; will-change: transform; pointer-events: auto; }
.ylw-leads { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.ylw-lead { fill: none; stroke: var(--ylw-ink); stroke-width: 1; opacity: .55; }
.ylw-lead.is-dot { fill: var(--ylw-ink); stroke: none; opacity: .75; }
.ylw-lead.is-sel { stroke: var(--ylw-accent); stroke-width: 1.5; opacity: 1; }
.ylw-lead.is-pin { fill: var(--ylw-accent); stroke: none; opacity: 1; }

/* district label: red numbered badge + name, badge-only when crowded */
.ylw-dl {
	display: inline-flex; gap: 6px; align-items: center; padding: 4px 11px 4px 4px;
	border: 0; border-radius: 999px; background: var(--ylw-accent); color: #fff;
	white-space: nowrap; cursor: pointer; box-shadow: 0 2px 8px rgba(17, 18, 15, .22);
}
.ylw-dl-badge {
	display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
	background: rgba(255, 255, 255, .18); font: 700 11px/1 var(--ylw-sans); font-variant-numeric: tabular-nums;
}
.ylw-dl-badge.is-wide { font-size: 9px; letter-spacing: -.02em; }
.ylw-dl-name { font: 700 12px/1 var(--ylw-sans); }
.ylw-dl.is-sel { background: var(--ylw-accent); }
.ylw-dl.is-sel .ylw-dl-badge { background: rgba(255, 255, 255, .3); }
.ylw-dl.is-mini { padding: 4px; }
.ylw-dl.is-mini .ylw-dl-name { display: none; }

/* context markers */
.ylw-poi {
	display: inline-flex; gap: 6px; align-items: center; padding: 4px 11px 4px 8px; border-radius: 999px;
	background: rgba(255, 254, 251, .94); border: 1px solid var(--ylw-line); color: var(--ylw-ink);
	font: 700 11.5px/1 var(--ylw-sans); white-space: nowrap; box-shadow: 0 2px 6px rgba(17, 18, 15, .12);
}
.ylw-poi svg { width: 12px; height: 12px; fill: var(--ylw-muted); }

/* hover card */
.ylw-labelcard {
	position: absolute; left: 0; top: 0; width: max-content; max-width: 220px; padding: 12px 14px;
	border-radius: 10px; background: var(--ylw-card); border: 1px solid var(--ylw-line);
	box-shadow: 0 6px 20px rgba(17, 18, 15, .16); pointer-events: auto; will-change: transform;
}
.ylw-labelcard[hidden] { display: none; }
.ylw-lc-t { display: block; font: 700 14px/1.2 var(--ylw-sans); }
.ylw-lc-p { margin: 4px 0 8px; color: var(--ylw-muted); font-size: 12.5px; }
.ylw-lc-go { padding: 0; border: 0; background: none; color: var(--ylw-accent); font: 700 12.5px/1 var(--ylw-sans); cursor: pointer; }
.ylw-gl .ylw-plate { box-shadow: 0 2px 6px rgba(17, 18, 15, .22); }
.ylw-gl.is-dim { opacity: .35; }
.ylw-gl.is-focus .ylw-plate { font-size: 19px; background: var(--ylw-accent); border-color: var(--ylw-accent); color: #fff; }
/* floating map controls */
.ylw-ctl { position: absolute; z-index: 2; }
.ylw-ctl-tl { left: 12px; top: 12px; }
.ylw-ctl-tc { left: 50%; top: 12px; transform: translateX(-50%); }
.ylw-ctl-tr { right: 12px; top: 12px; display: grid; gap: 8px; justify-items: end; }
.ylw-surface { background: rgba(255, 254, 251, .94); border: 1px solid var(--ylw-line); box-shadow: 0 2px 8px rgba(17, 18, 15, .12); backdrop-filter: blur(6px); }
.ylw-seg, .ylw-dropdown, .ylw-iconbtn, .ylw-stack, .ylw-ctl .ylw-btn, .ylw-menu, .ylw-legend-map {
	background: rgba(255, 254, 251, .94); border: 1px solid var(--ylw-line); box-shadow: 0 2px 8px rgba(17, 18, 15, .1); backdrop-filter: blur(6px);
}
.ylw-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; }
.ylw-seg-btn { height: 28px; padding: 0 12px; border: 0; border-radius: 999px; background: none; font: 700 12.5px/1 var(--ylw-sans); cursor: pointer; }
.ylw-seg-btn[aria-pressed="true"] { background: var(--ylw-soft); color: var(--ylw-accent); }
.ylw-dropdown { display: inline-flex; gap: 8px; align-items: center; height: 34px; padding: 0 14px; border-radius: 999px; font: 700 12.5px/1 var(--ylw-sans); cursor: pointer; }
.ylw-menu {
	position: absolute; left: 50%; top: 42px; transform: translateX(-50%);
	display: grid; width: max-content; min-width: 190px; max-height: 260px; overflow: auto; padding: 5px; border-radius: 10px;
}
.ylw-menu button { padding: 7px 10px; border: 0; border-radius: 6px; background: none; text-align: left; font-size: 13px; cursor: pointer; }
.ylw-menu button:hover { background: var(--ylw-chip); }
.ylw-menu button[aria-selected="true"] { background: var(--ylw-soft); color: var(--ylw-accent); font-weight: 700; }
.ylw-stack { display: grid; padding: 4px; border-radius: 10px; }
.ylw-stack .ylw-iconbtn { border: 0; box-shadow: none; background: none; }
.ylw-iconbtn {
	display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px;
	font: 700 15px/1 var(--ylw-sans); cursor: pointer;
}
.ylw-iconbtn:hover { background: var(--ylw-chip); }
.ylw-ctl .ylw-btn { height: 34px; border-radius: 999px; font-size: 12.5px; }
.ylw-needle { width: 0; height: 0; border: 5px solid transparent; border-bottom: 11px solid var(--ylw-accent); transform-origin: 50% 70%; }

.ylw-legend-map {
	position: absolute; left: 12px; bottom: 12px; z-index: 2;
	display: flex; flex-wrap: wrap; gap: 12px; padding: 7px 12px; border-radius: 999px; font-size: 11.5px; color: var(--ylw-muted);
}
.ylw-legend-map span { display: inline-flex; gap: 6px; align-items: center; }
.ylw-sw { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--ylw-line); }
.ylw-sw.is-market { background: var(--ylw-building); }
.ylw-sw.is-sel { background: var(--ylw-accent); border-color: var(--ylw-accent); }
.ylw-sw.is-around { background: #cfcdc8; }
.ylw-foot { display: grid; gap: 8px; padding-top: 4px; border-top: 1px solid var(--ylw-line); }
.ylw-live { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); }

@media (max-width: 820px) {
	.ylw { grid-template-columns: 1fr; grid-template-rows: 62vh auto; height: auto; }
	.ylw-stage { order: -1; }
	.ylw-side, .ylw-body { overflow: visible; }
	.ylw-ctl-tc { position: static; transform: none; }
	.ylw-ctl-tc .ylw-dropdown { display: none; }
	.ylw-legend-map { display: none; }
}
