:root {
  --accent: #F15A24;      /* Puente orange — brand chrome only */
  --accent-h: #D64A16;
  --teal: #00C4BD;        /* top bar background */
  --teal-deep: #0A413D;
  --pg: #FFFFFF;
  --pg-alt: #F5F5F5;
  --fg: #111111;
  --fg2: #555555;
  --fg3: #8A8A8A;
  --card: #FFFFFF;
  --bd: #E6E6E6;
  --green: #0B8A5B;
  --font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 40px;
  --space-6: 64px;
  --radius: 0px;
  --focus-ring: 3px solid var(--accent);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--pg);
  color: var(--fg);
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal-deep); }
button, input, select { font-family: inherit; font-size: 1rem; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--fg); color: #fff; padding: 12px 18px;
  font-weight: 700; font-size: 13px; text-decoration: none;
}
.skip-link:focus { left: 12px; top: 12px; }

:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ============ HEADER / BRAND CHROME (Puente identity — unchanged) ============ */
.site-header {
  background: var(--teal);
  border-bottom: 1px solid rgba(0,0,0,.14);
  position: sticky; top: 0; z-index: 40;
}
.site-header .in {
  max-width: 1100px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.site-header .logo-link { display: inline-block; line-height: 0; }
.site-header .logo-link img { height: 40px; width: auto; display: block; }
.brand-sub {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: #111; padding-left: 14px; margin-left: 2px; border-left: 1px solid rgba(0,0,0,.28);
}
.header-controls { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.tb {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 11px;
  font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #111;
  background: transparent; border: 1.5px solid rgba(0,0,0,.42); padding: 7px 10px; cursor: pointer;
}
.tb:hover { background: #111; color: #fff; border-color: #111; }
.tb[aria-pressed="true"] { background: #111; color: #fff; border-color: #111; }

.notice-banner {
  background: var(--pg-alt); border-bottom: 1px solid var(--bd);
  padding: 10px 20px; font-size: 12.5px; line-height: 1.5; color: var(--fg2);
}
.notice-banner .in { max-width: 1100px; margin: 0 auto; }

main { padding: var(--space-4) 20px var(--space-6); max-width: 1100px; margin: 0 auto; }

/* ============ HERO ============ */
.hero { padding: 0 0 var(--space-3); }
.eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 10px; display: inline-block;
  background: rgba(241,90,36,.1); padding: 6px 10px;
}
.page-title { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.08; margin: 0 0 8px; }
.page-lead { font-size: 16px; font-weight: 700; color: var(--fg); max-width: 60ch; margin: 0 0 var(--space-3); }

/* transit-style schematic map — replaces the geo map with a subway-diagram
   view of the corridor (one colored line per category, businesses as stops) */
.hero-network {
  position: relative; margin: 0 0 var(--space-5);
  display: flex; flex-direction: column; gap: var(--space-3);
  width: 100vw; left: 50%; transform: translateX(-50%); max-width: 2000px;
  padding: 0 40px; box-sizing: border-box;
}

.transit-panel { position: relative; border: 1.5px solid var(--bd); background: var(--pg); padding: var(--space-3); }
.hero-title-overlay {
  position: absolute; top: 4%; left: 4%; z-index: 5; max-width: 40%;
  background: color-mix(in oklch, var(--pg) 88%, transparent); padding: clamp(8px, 1.6vw, 18px) clamp(12px, 2vw, 20px);
}
.hero-title-overlay .eyebrow { font-size: clamp(11px, 1.4vw, 16px); }
.hero-title-overlay .page-title { margin: 6px 0 8px; font-size: clamp(22px, 4vw, 40px); }
.hero-title-overlay .page-lead { margin: 0; font-size: clamp(13px, 1.6vw, 18px); }
.transit-panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: var(--space-2); }
.transit-badge {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; border-radius: 50%; flex-shrink: 0;
}
.transit-panel-title { font-size: 13px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--fg); }
.transit-svg-scroll {
  position: relative; width: 100%; overflow: hidden; padding-top: 71.43%;
}
.transit-svg {
  position: absolute; top: 0; left: 0; width: 71.43%; height: auto;
  max-width: none; min-width: 0; transform-origin: top left; transform: rotate(90deg) translateY(-100%);
  display: block; background: var(--pg-alt); border: 1px solid var(--bd);
}
.transit-note { font-size: 11.5px; color: var(--fg3); margin: 8px 0 0; }

.transit-street-name { pointer-events: none; }
.transit-street-label {
  fill: #fff; font-size: 15px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  font-family: var(--font-family);
}
.transit-street-pill { fill: var(--fg); }
.transit-axis-label { fill: var(--fg3); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.transit-tick { stroke: var(--bd); stroke-width: 2; }
.transit-cross-label { fill: var(--fg2); font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; }
.transit-line { fill: none; stroke-linecap: round; stroke-linejoin: round; transition: opacity 150ms ease, stroke-width 150ms ease; cursor: pointer; }
.transit-node {
  fill: #fff; stroke-width: 2.5; cursor: pointer;
  transition: r 120ms ease, stroke-width 120ms ease, opacity 150ms ease;
}
.transit-node.node-highlight { r: 9; stroke-width: 3.5; }
.transit-compass { fill: none; stroke: var(--fg3); stroke-width: 1.5; }
.transit-compass-label { fill: var(--fg3); font-size: 10px; font-weight: 700; }

.map-legend {
  display: flex; flex-wrap: wrap; flex-direction: row; align-items: center; gap: 8px 22px;
  border: 1.5px solid var(--bd); padding: var(--space-3);
}
.map-legend-title { flex-basis: 100%; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg3); margin: 0 0 2px; }
.map-legend-item {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--fg2);
  background: none; border: 0; cursor: pointer; padding: 3px 2px; transition: opacity 150ms ease; text-align: left;
}
.map-legend-swatch { width: 18px; height: 4px; border-radius: 3px; flex-shrink: 0; }
.hero-network.has-active-category .map-legend-item { opacity: .4; }
.hero-network.has-active-category .map-legend-item.legend-active { opacity: 1; }

.transit-side { display: flex; flex-direction: column; gap: var(--space-3); }
@media (min-width: 720px) { .transit-side { flex-direction: row; align-items: stretch; } .transit-side .map-legend { flex: 1; } .transit-side .transit-stat { flex-basis: 260px; } }
.transit-stat {
  border: 1.5px solid var(--bd); padding: var(--space-3); display: flex; flex-direction: column; gap: 4px;
}
.transit-stat-num { font-size: 30px; font-weight: 700; color: var(--accent); line-height: 1; }
.transit-stat-label { font-size: 11.5px; color: var(--fg2); font-weight: 400; }

@media (min-width: 640px) { .page-title { font-size: 40px; } }


/* ============ SEARCH ============ */
.search-panel { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-4); }
.search-input-row { display: flex; gap: var(--space-2); }
.search-input-row input[type="search"] {
  flex: 1; border: 1.5px solid var(--bd); background: #fff; padding: 13px 14px; font-size: 15px; color: var(--fg);
}
.search-input-row input[type="search"]:focus { outline: none; border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--bd);
  background: #fff; color: var(--fg); font-weight: 700; font-size: 13px; padding: 12px 18px; cursor: pointer;
}
.btn:hover { border-color: var(--fg); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); border-color: var(--accent-h); }

/* ============ CATEGORY LINE SELECTOR ============ */
.category-filters { display: flex; flex-wrap: wrap; gap: 8px; overflow-x: auto; padding: 2px 0 4px; }
.line-select {
  --cat-color: var(--fg3);
  display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
  font: inherit; font-size: 12.5px; font-weight: 700; color: var(--fg);
  background: #fff; border: 1.5px solid var(--bd); padding: 7px 12px 7px 7px; cursor: pointer; white-space: nowrap;
  transition: opacity 120ms ease, border-color 120ms ease, padding 120ms ease, box-shadow 120ms ease;
}
.line-select:hover, .line-select:focus-visible { border-color: var(--cat-color); opacity: 1; }
.line-select[aria-pressed="true"] {
  border-color: var(--cat-color); border-width: 2px; color: var(--cat-color);
  box-shadow: inset 0 -3px 0 var(--cat-color); padding: 6px 13px 5px 6px; /* "extends slightly" when selected */
}
.line-select-count { color: var(--fg3); font-weight: 400; }
.line-select[aria-pressed="true"] .line-select-count { color: var(--cat-color); font-weight: 700; }

/* Hovering or focusing one line de-emphasizes the others (not the reverse —
   the hovered/focused/selected one always stays at full opacity). */
.category-filters:hover .line-select:not(:hover),
.category-filters:focus-within .line-select:not(:focus-visible) { opacity: .55; }
.category-filters.has-active-line .line-select[aria-pressed="false"] { opacity: .7; }
.category-filters.has-active-line .line-select[aria-pressed="false"]:hover,
.category-filters.has-active-line .line-select[aria-pressed="false"]:focus-visible { opacity: 1; }

/* Selecting a category draws a thin colored connector down to the results
   region, so the control and the results it affects read as one system. */
.category-filters.has-active-line { border-bottom: 3px solid var(--active-cat-color, var(--bd)); }
.result-indicator {
  display: inline-block; width: 8px; height: 8px; margin-right: 6px; background: var(--fg3);
  transition: background 120ms ease;
}

/* ============ CATEGORY NODES (shape + letter + color) ============ */
.cat-node {
  --cat-color: var(--fg3);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 26px; height: 26px; background: var(--cat-color); color: #fff;
  font-weight: 700; font-size: 12px; line-height: 1;
  transition: transform 120ms ease;
}
.line-select:hover .cat-node, .line-select:focus-visible .cat-node,
.cat-node:hover, .cat-node:focus-visible { transform: scale(1.15); }
.cat-node.large { width: 52px; height: 52px; font-size: 22px; }
.cat-node.shape-square {}
.cat-node.shape-diamond { clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); }
.cat-node.shape-triangle { clip-path: polygon(50% 0%, 0% 100%, 100% 100%); padding-top: 4px; }
.cat-node.shape-hexagon { clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%); }
.cat-node.shape-circle { border-radius: 50%; }
.cat-node.shape-rounded { border-radius: 30%; }
.cat-node.shape-pill { width: 34px; border-radius: 999px; }
.cat-node.large.shape-pill { width: 68px; }
.cat-node.shape-ring, .cat-node.shape-dashed-ring {
  background: transparent; color: var(--cat-color); border: 3px solid var(--cat-color); border-radius: 50%;
}
.cat-node.shape-dashed-ring { border-style: dashed; }

.result-summary {
  position: relative; font-size: 13px; font-weight: 700; color: var(--fg2);
  border-top: 1px solid var(--bd); padding-top: var(--space-2);
  display: flex; align-items: center;
}
.result-summary[data-live="true"] { color: var(--teal-deep); }

/* ============ BUSINESS CARDS — colored "stop" accent per category ============ */
.business-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-3); margin-top: var(--space-4); list-style: none; padding: 0;
}
.business-card {
  --cat-color: var(--fg3);
  border: 1.5px solid var(--bd); border-left: 6px solid var(--cat-color);
  background: var(--card); display: flex; flex-direction: column;
  animation: cardIn 200ms ease both;
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.business-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.08); }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.business-card .card-top { padding: 14px 16px 10px; }
.card-top-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.stop-number { font-size: 11px; font-weight: 700; color: var(--fg3); }
.business-card h3 { margin: 0; font-size: 16.5px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; }
.business-card .category-label {
  display: inline-block; margin-top: 6px; font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--fg3);
}
.business-card .address { font-size: 12.5px; color: var(--fg2); margin-top: 8px; }

.verify-badge {
  display: inline-flex; align-items: center; font-size: 10px; font-weight: 700; letter-spacing: 0.03em;
  color: #fff; background: var(--fg3); padding: 4px 8px; margin-top: 10px; align-self: flex-start;
}

.card-actions { margin-top: auto; display: grid; grid-template-columns: 1fr 1fr; border-top: 1.5px solid var(--bd); }
.card-actions button, .card-actions a {
  display: flex; align-items: center; justify-content: center; padding: 12px 4px; font: inherit; font-size: 12px;
  font-weight: 700; color: var(--teal-deep); text-decoration: none; background: none; border: 0;
  border-right: 1px solid var(--bd); cursor: pointer;
}
.card-actions button:last-child, .card-actions a:last-child { border-right: 0; }
.card-actions button:hover, .card-actions a:hover { background: var(--pg-alt); }

/* ============ NO RESULTS — lines that stop short ============ */
.empty-state { border: 1px dashed var(--bd); padding: var(--space-5) var(--space-4); text-align: center; color: var(--fg3); }
.empty-state svg { display: block; margin: 0 auto var(--space-3); }
.empty-state p { margin: 4px 0; }
.empty-state strong { color: var(--fg); font-size: 16px; }
/* The reveal animation only runs when motion is allowed — the lines and
   circles are fully visible by default so reduced-motion users never see
   a "stuck hidden" state. */
@media (prefers-reduced-motion: no-preference) {
  .empty-state svg line { stroke-dasharray: 140; stroke-dashoffset: 140; animation: lineReveal 500ms ease forwards; }
  .empty-state svg circle { opacity: 0; animation: fadeIn 200ms ease 450ms forwards; }
  @keyframes lineReveal { to { stroke-dashoffset: 0; } }
  @keyframes fadeIn { to { opacity: 1; } }
}

.site-footer {
  border-top: 1.5px solid var(--bd); padding: var(--space-4) 20px; margin-top: var(--space-6);
  font-size: 13px; color: var(--fg2);
}
.site-footer .in { max-width: 1100px; margin: 0 auto; }

[hidden] { display: none !important; }

/* ============ DETAIL DIALOG — category-colored arrival hero ============ */
dialog#detailDialog { border: 1.5px solid var(--bd); padding: 0; max-width: 560px; width: calc(100% - 32px); }
dialog#detailDialog::backdrop { background: rgba(10,20,20,.55); }
#detailBody { padding: 0 20px 20px; }
#detailBody .detail-hero {
  --cat-color: var(--teal-deep);
  background: var(--cat-color); color: #fff; padding: 20px; margin: 0 -20px 18px;
  display: flex; align-items: center; gap: 14px;
  animation: heroArrive 220ms ease both;
}
@keyframes heroArrive {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: translateX(0); }
}
#detailBody .detail-hero .cat-node { background: rgba(255,255,255,.18); }
#detailBody .detail-hero .shape-ring, #detailBody .detail-hero .shape-dashed-ring { border-color: #fff; color: #fff; }
#detailBody .detail-hero h2 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
#detailBody .detail-hero .category-label { color: rgba(255,255,255,.82); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; margin: 0; }
#detailBody .info-block { margin: 10px 0; }
#detailDialog .dialog-close-row { display: flex; justify-content: flex-end; padding: 14px 20px 0; }

/* ============ SEARCH PANEL EXTRAS: surprise, progress ============ */
.surprise-btn { display: inline-flex; align-items: center; gap: 7px; color: var(--teal-deep); border-color: var(--bd); }
.surprise-btn svg { transition: transform 420ms cubic-bezier(.2,.8,.2,1); }
.surprise-btn.spin svg { transform: rotate(300deg); }

.progress-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.progress-track { flex: 1; max-width: 220px; height: 5px; background: var(--bd); position: relative; overflow: hidden; }
.progress-fill { position: absolute; inset: 0 auto 0 0; width: 0%; background: var(--accent); transition: width 400ms ease; }
.progress-summary { font-size: 11.5px; font-weight: 700; color: var(--fg3); margin: 0; white-space: nowrap; }
.business-card.visited .stop-number::after { content: " \2713"; color: var(--green); }

/* ============ TOAST (line-complete celebration) ============ */
.toast-stack { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--fg); color: #fff; padding: 12px 14px; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; gap: 12px; max-width: min(90vw, 380px);
  box-shadow: 0 8px 22px rgba(0,0,0,.28); animation: toastIn 220ms ease both;
}
.toast .cat-node { flex-shrink: 0; }
.toast-close { background: none; border: 0; color: rgba(255,255,255,.7); font: inherit; font-weight: 700; cursor: pointer; padding: 2px 4px; }
.toast-close:hover { color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: no-preference) { .toast.toast-out { animation: toastOut 220ms ease both; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

/* ============ ACCESSIBILITY MODES ============ */
body.high-contrast {
  --fg2: #000000; --fg3: #000000; --bd: #000000;
}
body.high-contrast .cat-node.shape-ring,
body.high-contrast .cat-node.shape-dashed-ring { border-width: 4px; }
body.high-contrast .business-card { border-left-width: 8px; }
body.large-text { font-size: 19px; }
body.large-text .cat-node { width: 30px; height: 30px; font-size: 14px; }
