/* tea.place — design tokens (port of tokens.jsx) */
:root, [data-theme="light"] {
  --bg: #f5f1e8;
  --bg-raised: #fafaf3;
  --bg-sunken: #ede8db;
  --fg-1: #1f1d18;
  --fg-2: #5a554a;
  --fg-3: #9a958a;
  --hairline: rgba(31,29,24,0.10);
  --hairline-strong: rgba(31,29,24,0.18);
  --overlay: rgba(31,29,24,0.04);
  --steep: #3a6b45;
  --steep-ink: #234029;
  --cream: #f5f1e8;
  --stone: #9a958a;
  --cat-green: #4a7c59;
  --cat-red: #8b2500;
  --cat-yellow: #c5a63d;
  --cat-oolong: #b87333;
  --cat-white: #b0a18c;
  --cat-dark: #3e2723;
  --cat-puerh: #4e342e;
  --map-land: #efe9da;
  --map-water: #dbd6c7;
  --map-street: rgba(31,29,24,0.05);
  --map-block: rgba(31,29,24,0.03);
  --map-edge: rgba(31,29,24,0.08);

  /* type ×1.6 */
  --t-large: 26px; --t-title: 22px; --t-title2: 19px; --t-title3: 18px;
  --t-headline: 16px; --t-body: 14px; --t-foot: 12px; --t-cap: 11px;
  /* spacing ×2 */
  --xs: 4px; --sm: 6px; --md: 10px; --lg: 12px; --xl: 18px; --xxl: 24px; --xxxl: 32px;
  /* radius */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px; --r-pill: 999px;
  /* motion */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  --f-sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --f-serif: "Noto Serif SC", "IBM Plex Serif", ui-serif, Georgia, serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
[data-theme="dark"] {
  --bg: #1a1814;
  --bg-raised: #252220;
  --bg-sunken: #13110e;
  --fg-1: #f0ebe0;
  --fg-2: #9a958a;
  --fg-3: #6b665c;
  --hairline: rgba(240,235,224,0.12);
  --hairline-strong: rgba(240,235,224,0.22);
  --overlay: rgba(240,235,224,0.04);
  --steep: #6ea37a;
  --steep-ink: #a8d4b1;
  --cream: #f0ebe0;
  --stone: #6b665c;
  --map-land: #221f1b;
  --map-water: #181612;
  --map-street: rgba(240,235,224,0.06);
  --map-block: rgba(240,235,224,0.03);
  --map-edge: rgba(240,235,224,0.10);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg-1);
  font-family: var(--f-sans);
  font-size: var(--t-body);
  line-height: 1.45;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}
.mono { font-family: var(--f-mono); letter-spacing: -0.01em; }
.serif { font-family: var(--f-serif); }
.pinyin { font-style: italic; }

/* Constellation */
.const-bar {
  display: flex;
  align-items: center;
  gap: var(--md);
  padding: var(--sm) var(--lg);
  background: var(--bg-raised);
  border-bottom: 1px solid var(--hairline);
  font-size: var(--t-foot);
  color: var(--fg-2);
}
.const-cells { display: flex; gap: 3px; }
.const-cell {
  width: 11px; height: 11px;
  border-radius: 2px;
  background: var(--hairline-strong);
  cursor: pointer;
  text-decoration: none;
}
.const-cell.visited { background: var(--fg-3); }
.const-cell.current { background: var(--steep); }
.const-label { font-family: var(--f-mono); font-size: var(--t-cap); }
.const-domain {
  font-family: var(--f-mono);
  font-size: var(--t-cap);
  color: var(--steep);
  margin-left: auto;
}

/* Map header */
.map-header {
  display: flex;
  align-items: center;
  gap: var(--md);
  padding: var(--md) var(--lg);
  background: var(--bg);
  border-bottom: 1px solid var(--hairline);
}
.brand-title {
  font-family: var(--f-serif);
  font-size: var(--t-title2);
  letter-spacing: 0.01em;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  min-width: 280px;
  color: var(--fg-2);
  flex: 0 1 320px;
}
.search-box .ph { flex: 1; font-size: var(--t-foot); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  color: var(--fg-1);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md);
  padding: 6px 10px;
  font-family: var(--f-sans);
  font-size: var(--t-foot);
  font-weight: 500;
  cursor: pointer;
  height: 28px;
  text-decoration: none;
  transition: background 160ms var(--ease);
}
.btn:hover { background: var(--overlay); }
.btn-primary { background: var(--fg-1); color: var(--bg); border-color: transparent; }
.btn-steep { background: var(--steep); color: #fafaf3; border-color: transparent; }
.btn-md { height: 36px; padding: 9px 14px; font-size: var(--t-body); }
.btn-lg { height: 44px; padding: 12px 18px; font-size: var(--t-headline); }
.icon-btn {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--fg-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* SVG icons */
.lucide {
  display: inline-block;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Map area */
.map-area {
  position: relative;
  flex: 1;
  overflow: hidden;
}
.map-svg-wrap {
  position: absolute;
  inset: 0;
  background: var(--map-water);
  overflow: hidden;
}
.map-svg-wrap svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* POI pin */
.pin {
  position: absolute;
  transform: translate(-50%, -50%);
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: transform 200ms var(--ease);
}
.pin:hover { transform: translate(-50%, -50%) scale(1.15); }
.pin.active { transform: translate(-50%, -50%) scale(1.15); }
.pin-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--bg-raised), 0 0 0 3px var(--hairline-strong);
  transition: box-shadow 200ms var(--ease);
}
.pin.active .pin-dot {
  box-shadow: 0 0 0 3px var(--bg-raised), 0 0 0 4.5px var(--fg-1), 0 4px 12px rgba(0,0,0,0.18);
}
.pin-label {
  font-family: var(--f-serif);
  font-size: var(--t-foot);
  color: var(--fg-1);
  background: var(--bg-raised);
  padding: 2px 7px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  display: none;
}
.pin.active .pin-label,
.pin:hover .pin-label { display: inline-block; }

/* Map controls */
.map-controls {
  position: absolute;
  right: var(--lg);
  top: var(--lg);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.map-controls .group {
  background: var(--bg-raised);
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.map-controls .group button {
  border: none;
  width: 36px; height: 36px;
  background: transparent;
  color: var(--fg-1);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.map-controls .group button:hover { background: var(--overlay); }
.map-controls .hair { height: 1px; background: var(--hairline); }

/* Map attribution */
.map-attr {
  position: absolute;
  bottom: var(--md);
  right: var(--lg);
  background: var(--bg-raised);
  padding: 4px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline);
  font-family: var(--f-mono);
  font-size: var(--t-cap);
  color: var(--fg-3);
}

/* Desktop sidebar panel */
.panel {
  position: absolute;
  top: var(--lg);
  left: var(--lg);
  bottom: var(--lg);
  width: 360px;
  background: var(--bg-raised);
  border-radius: var(--r-lg);
  border: 1px solid var(--hairline);
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 2;
}
.panel-head {
  padding: var(--lg);
  border-bottom: 1px solid var(--hairline);
}
.panel-head .count {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.panel-head .count .num {
  font-family: var(--f-serif);
  font-size: var(--t-title3);
  letter-spacing: 0.01em;
}
.chips {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--t-foot);
  padding: 5px 10px;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--fg-2);
  border: 1px solid var(--hairline-strong);
  cursor: pointer;
  font-family: var(--f-sans);
}
.chip.active { background: var(--fg-1); color: var(--bg); border-color: var(--fg-1); }
.panel-list { flex: 1; overflow: auto; }

/* Place card (dense — used in panel) */
.place-card-dense {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-top: 1px solid var(--hairline);
  padding: var(--md) var(--lg);
  cursor: pointer;
  font-family: var(--f-sans);
  color: var(--fg-1);
}
.place-card-dense:hover,
.place-card-dense.active { background: var(--overlay); }
.place-card-dense .row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.place-card-dense .cat-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transform: translateY(-1px);
}
.place-card-dense .tea-name {
  display: inline-flex; align-items: baseline; gap: 8px;
}
.place-card-dense .tea-name .cn {
  font-family: var(--f-serif);
  font-size: var(--t-headline);
  letter-spacing: 0.02em;
}
.place-card-dense .tea-name .pinyin {
  font-family: var(--f-serif);
  font-size: calc(var(--t-headline) * 0.65);
  color: var(--fg-2);
  font-style: italic;
}
.place-card-dense .nbhd {
  margin-left: auto;
  font-family: var(--f-mono);
  font-size: var(--t-cap);
  color: var(--fg-2);
}
.place-card-dense .meta {
  margin-top: 4px;
  padding-left: 16px;
  font-size: var(--t-foot);
  color: var(--fg-2);
}

/* Mobile bottom sheet */
.mobile-sheet {
  display: none;
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: var(--bg-raised);
  border-top-left-radius: var(--r-xl);
  border-top-right-radius: var(--r-xl);
  border-top: 1px solid var(--hairline);
  box-shadow: 0 -8px 24px rgba(0,0,0,0.08);
  padding-bottom: var(--lg);
  max-height: 42%;
  z-index: 3;
  overflow: auto;
}
.mobile-sheet .grip {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}
.mobile-sheet .grip span {
  width: 36px; height: 4px;
  border-radius: 2px;
  background: var(--hairline-strong);
}
.mobile-sheet .head {
  padding: 0 var(--lg) var(--md);
}
.mobile-sheet .head .count {
  display: flex; align-items: baseline; gap: 6px;
}

/* Responsive */
@media (max-width: 768px) {
  .panel { display: none; }
  .mobile-sheet { display: block; }
  .search-box { display: none; }
  .map-header .desktop-only { display: none; }
}

/* Hide list view button on mobile */
@media (max-width: 600px) {
  .const-domain { display: inline; }
}

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