/* ============================================================
   Cafe Finder — Design System
   ============================================================ */

:root {
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Manrope', ui-sans-serif, system-ui, -apple-system, sans-serif;

  --bg: #FBF6EF;
  --bg-2: #F3EBDF;
  --surface: #FFFFFF;
  --surface-2: #FBF7F0;
  --surface-3: #F4EDE2;
  --ink: #2A1B10;
  --ink-2: #5C4633;
  --ink-3: #9C8571;
  --line: #E8DCCB;
  --line-2: #F0E7D9;

  --brand: #6F4E37;
  --brand-2: #8A5A35;
  --brand-ink: #FFFFFF;
  --accent: #C1853B;
  --accent-soft: rgba(193, 133, 59, 0.14);

  --open: #3E8E5A;
  --open-bg: #E5F3EA;
  --closed: #C0564A;
  --closed-bg: #FBE9E6;
  --unknown-bg: #F0E9DF;

  --star: #E9A23B;
  --gold: #C9A05C;

  --glass: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.5);
  --nav-bg: rgba(251, 246, 239, 0.82);

  --shadow-sm: 0 1px 2px rgba(42, 27, 16, 0.06), 0 2px 8px rgba(42, 27, 16, 0.05);
  --shadow-md: 0 6px 20px rgba(42, 27, 16, 0.09);
  --shadow-lg: 0 18px 50px rgba(42, 27, 16, 0.16);
  --shadow-brand: 0 8px 24px rgba(193, 133, 59, 0.32);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 30px;

  --nav-h: 68px;
  --trans: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

html[data-theme="dark"] {
  --bg: #17100B;
  --bg-2: #1F1610;
  --surface: #221811;
  --surface-2: #2A1E15;
  --surface-3: #33251A;
  --ink: #F6EDDF;
  --ink-2: #D9C3AC;
  --ink-3: #9A8370;
  --line: #3A2A1D;
  --line-2: #2E2117;

  --brand: #C08A4E;
  --brand-2: #E0A96B;
  --brand-ink: #241609;
  --accent: #E0B27A;
  --accent-soft: rgba(224, 178, 122, 0.16);

  --open: #63B88B;
  --open-bg: #1F3A2C;
  --closed: #E07A6E;
  --closed-bg: #3A2320;
  --unknown-bg: #2E241B;

  --star: #E9A23B;

  --glass: rgba(30, 21, 15, 0.66);
  --glass-border: rgba(255, 255, 255, 0.08);
  --nav-bg: rgba(23, 16, 11, 0.82);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 10px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 55px rgba(0, 0, 0, 0.55);
  --shadow-brand: 0 10px 28px rgba(224, 178, 122, 0.22);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-size: 15px;
  transition: background-color 0.35s ease, color 0.35s ease;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; font-weight: 700; line-height: 1.15; }
p { margin: 0; }
code { font-family: ui-monospace, monospace; font-size: 0.9em; background: var(--surface-3); padding: 2px 6px; border-radius: 6px; }

.app-shell { min-height: 100vh; position: relative; }

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

.is-hidden { display: none !important; }

body.modal-locked { overflow: hidden; }

.view {
  display: none;
  animation: viewIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.view.is-active { display: block; }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Navbar
   ============================================================ */
#navbar-root {
  position: sticky;
  top: 0;
  z-index: 900;
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--line-2);
}
.navbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: var(--nav-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; margin-right: 8px; }
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #fff;
  display: grid; place-items: center;
  box-shadow: var(--shadow-brand);
  transition: transform var(--trans);
}
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.05); }
.brand-mark svg { width: 20px; height: 20px; }
.brand-text { font-family: var(--font-display); font-weight: 900; font-size: 20px; letter-spacing: -0.02em; color: var(--ink); }
.brand-text span { color: var(--brand); }

.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-link {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 14px;
  border-radius: 999px;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 14px;
  transition: all var(--trans);
  border: 1px solid transparent;
}
.nav-link svg { width: 16px; height: 16px; }
.nav-link:hover { color: var(--ink); background: var(--surface-3); }
.nav-link.is-active { color: var(--brand); background: var(--accent-soft); border-color: var(--accent-soft); }
.nav-link.is-active svg { color: var(--accent); }

.nav-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nav-btn {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  display: grid; place-items: center;
  transition: all var(--trans);
}
.nav-btn:hover { color: var(--brand); border-color: var(--brand); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.nav-btn svg { width: 18px; height: 18px; }
.nav-btn.is-located { color: #fff; background: var(--brand); border-color: var(--brand); }
.nav-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px); left: 50%;
  transform: translateX(-50%) translateY(2px);
  background: var(--ink); color: var(--bg);
  font-size: 11px; font-weight: 600;
  padding: 5px 9px; border-radius: 8px;
  white-space: nowrap; opacity: 0; pointer-events: none;
  transition: all 0.18s ease;
  z-index: 50;
}
.nav-btn[data-tooltip]:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }

.profile-wrap { position: relative; }
.profile-menu {
  position: absolute;
  top: calc(100% + 12px); right: 0;
  min-width: 230px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  opacity: 0; visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--trans);
  z-index: 80;
}
.profile-menu.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
.profile-menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line-2); margin-bottom: 6px; }
.profile-menu-head strong { font-family: var(--font-display); font-size: 15px; display: block; }
.profile-menu-head span { font-size: 12px; color: var(--ink-3); }
.profile-menu a, .profile-menu button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 10px 12px;
  border: 0; background: none;
  border-radius: 10px;
  font-size: 13.5px; font-weight: 600;
  color: var(--ink-2);
  transition: all 0.15s ease;
}
.profile-menu a:hover, .profile-menu button:hover { background: var(--surface-3); color: var(--ink); }
.profile-menu svg { width: 16px; height: 16px; color: var(--brand); }

.hamburger { display: none; }

/* ---------- Drawer (mobile) ---------- */
.drawer { position: fixed; inset: 0; z-index: 1000; visibility: hidden; }
.drawer.is-open { visibility: visible; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(20, 10, 4, 0.5); backdrop-filter: blur(3px); opacity: 0; transition: opacity 0.3s; }
.drawer.is-open .drawer-backdrop { opacity: 1; }
.drawer-panel {
  position: absolute; top: 0; left: 0; bottom: 0;
  width: min(320px, 86vw);
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px;
  transform: translateX(-105%);
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex; flex-direction: column; gap: 20px;
}
.drawer.is-open .drawer-panel { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-links { display: flex; flex-direction: column; gap: 6px; }
.drawer-link {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px;
  border-radius: 12px;
  font-weight: 600; font-size: 15px;
  color: var(--ink-2);
  transition: all var(--trans);
}
.drawer-link svg { width: 18px; height: 18px; }
.drawer-link:hover, .drawer-link.is-active { background: var(--accent-soft); color: var(--brand); }
.drawer-actions { margin-top: auto; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 13.5px;
  line-height: 1;
  transition: all var(--trans);
  overflow: hidden;
  user-select: none;
}
.btn svg { width: 16px; height: 16px; transition: transform var(--trans); }
.btn:active { transform: scale(0.97); }

.btn--primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: var(--brand-ink);
  box-shadow: var(--shadow-brand);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(193, 133, 59, 0.4); }
.btn--primary:hover svg { transform: translateY(-1px); }

.btn--ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line); }
.btn--ghost:hover { color: var(--brand); border-color: var(--brand); background: var(--surface-2); transform: translateY(-1px); }

.btn--lg { padding: 14px 24px; font-size: 14.5px; }
.btn--sm { padding: 8px 13px; font-size: 12.5px; border-radius: 10px; }
.btn--full { width: 100%; }
.btn:disabled { opacity: 0.7; cursor: default; }
.btn.is-loading { color: transparent; pointer-events: none; }
.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
.btn--ghost.is-loading::after { border-color: var(--line); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Hero
   ============================================================ */
.hero-root { position: relative; }
.hero {
  position: relative;
  padding: 88px 24px 40px;
  text-align: center;
  background:
    radial-gradient(1200px 480px at 50% -10%, var(--accent-soft), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg) 40%, var(--bg-2));
}
.hero-orbs { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.hero-orb { position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.55; pointer-events: none; }
.hero-orb--1 { width: 420px; height: 420px; background: var(--accent-soft); top: -180px; left: -120px; }
.hero-orb--2 { width: 360px; height: 360px; background: rgba(193, 133, 59, 0.12); top: -120px; right: -100px; }
.hero-orb--3 { width: 300px; height: 300px; background: rgba(111, 78, 55, 0.08); bottom: -160px; left: 38%; }

.hero-content { position: relative; max-width: 720px; margin: 0 auto; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 12.5px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--brand);
  background: var(--accent-soft);
  border: 1px solid rgba(193, 133, 59, 0.2);
  padding: 7px 14px; border-radius: 999px;
  animation: fadeUp 0.6s 0.05s both;
}
.hero-eyebrow svg { width: 14px; height: 14px; }
.hero-title {
  font-size: clamp(38px, 6.5vw, 64px);
  font-weight: 900;
  letter-spacing: -0.03em;
  margin: 20px 0 12px;
  animation: fadeUp 0.6s 0.12s both;
}
.hero-title em { font-style: italic; color: var(--brand); }
.hero-subtitle {
  color: var(--ink-2);
  font-size: clamp(16px, 2.4vw, 19px);
  font-weight: 500;
  animation: fadeUp 0.6s 0.2s both;
}

.hero-search {
  max-width: 620px;
  margin: 34px auto 0;
  position: relative;
  animation: fadeUp 0.6s 0.28s both;
}
.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 8px 8px 20px;
  box-shadow: var(--shadow-lg);
  transition: all var(--trans);
}
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-lg); }
.search-icon { color: var(--ink-3); display: grid; }
.search-icon svg { width: 20px; height: 20px; }
#hero-search {
  flex: 1;
  border: 0; outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15.5px;
  font-weight: 500;
  padding: 8px 6px;
  min-width: 0;
}
#hero-search::placeholder { color: var(--ink-3); }
.btn--search { flex-shrink: 0; }
.btn--search svg { width: 17px; height: 17px; }

.search-dropdown {
  position: absolute;
  top: calc(100% + 10px); left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  opacity: 0; transform: translateY(-8px);
  pointer-events: none;
  transition: all 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  text-align: left;
  z-index: 60;
  max-height: 320px;
  overflow-y: auto;
}
.search-dropdown[hidden] { display: block; }
.search-dropdown.is-visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.sugg-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border: 0; background: none;
  border-radius: 12px;
  text-align: left;
  transition: background 0.15s ease;
}
.sugg-item:hover, .sugg-item.is-selected { background: var(--surface-3); }
.sugg-item > svg { width: 17px; height: 17px; color: var(--brand); flex-shrink: 0; }
.sugg-main { font-weight: 600; font-size: 14px; color: var(--ink); }
.sugg-label { font-weight: 600; font-size: 14px; color: var(--ink); }
.sugg-sub { margin-left: auto; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.sugg-group-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-3);
  padding: 8px 12px 6px;
}
.sugg-group-title svg { width: 14px; height: 14px; }
.sugg-clear {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  border: 0; background: none;
  border-top: 1px solid var(--line-2);
  font-size: 13px; font-weight: 600;
  color: var(--closed);
  border-radius: 0 0 12px 12px;
}
.sugg-clear:hover { background: var(--closed-bg); }
.sugg-clear svg { width: 15px; height: 15px; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Results section (Discover)
   ============================================================ */
.results-section { padding: 34px 0 80px; }
.results-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 24px;
}
.page-eyebrow {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 8px;
}
.page-eyebrow svg { width: 14px; height: 14px; }
.results-title { font-size: clamp(26px, 3.6vw, 36px); letter-spacing: -0.02em; }
.results-head-actions { display: flex; gap: 10px; }

.cafe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
}

/* ============================================================
   Cafe cards
   ============================================================ */
.cafe-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--trans), box-shadow var(--trans), border-color var(--trans);
  animation: cardIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  display: flex;
  flex-direction: column;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.cafe-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: rgba(193, 133, 59, 0.45); }
.cafe-card.is-active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-md); }
.cafe-card.is-hover { border-color: var(--accent); }

.cafe-card-media { position: relative; aspect-ratio: 4/3; background: var(--surface-3); }
.cafe-card-media::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(24, 14, 6, 0.30) 0%, rgba(24, 14, 6, 0) 32%, rgba(24, 14, 6, 0) 60%, rgba(24, 14, 6, 0.55) 100%);
  pointer-events: none;
  z-index: 0;
}
.media-topline,
.dist-badge { z-index: 2; }
.cafe-card-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.cafe-card:hover .cafe-card-media img { transform: scale(1.06); }
.cafe-card-media img.is-broken { opacity: 0; }
.media-fallback {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--ink-3);
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
}
.media-fallback svg { width: 42px; height: 42px; }

.media-topline {
  position: absolute; top: 12px; left: 12px; right: 12px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px;
}
.chip-mini {
  display: inline-flex; align-items: center;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 700;
  color: var(--ink-2);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.fav-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid; place-items: center;
  color: var(--ink-2);
  transition: all var(--trans);
  box-shadow: var(--shadow-sm);
}
.fav-btn svg { width: 17px; height: 17px; transition: transform var(--trans); }
.fav-btn:hover { transform: scale(1.12); color: var(--closed); }
.fav-btn.is-fav { color: #fff; background: linear-gradient(135deg, #E0586B, #C24555); border-color: transparent; }
.fav-btn.is-fav svg { fill: currentColor; transform: scale(1.1); }
.fav-btn.is-fav svg { animation: heartPop 0.5s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes heartPop {
  0% { transform: scale(0.4); }
  55% { transform: scale(1.35); }
  100% { transform: scale(1.1); }
}

.dist-badge {
  position: absolute;
  bottom: 12px; left: 12px;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 700;
  color: var(--ink);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.dist-badge svg { width: 12px; height: 12px; color: var(--brand); }

.cafe-card-body { padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.cafe-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.cafe-title-wrap { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex: 1; }
.cafe-rank {
  font-size: 12px;
  font-weight: 800;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  line-height: 1.5;
}
.cafe-card-title {
  font-size: 17.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}
.cafe-card-meta { display: flex; align-items: center; gap: 10px; }
.rating { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; }
.rating b { font-size: 14.5px; font-weight: 800; color: var(--ink); }
.rating .reviews { color: var(--ink-3); font-weight: 500; }
.star-ic { width: 14px; height: 14px; color: var(--star); fill: var(--star); }
.star-ic.is-empty { color: var(--line); fill: var(--line); }
.price { font-weight: 800; color: var(--ink-2); letter-spacing: 1px; }

.cafe-card-addr {
  display: flex; align-items: flex-start; gap: 6px;
  color: var(--ink-3);
  font-size: 13px;
  min-height: 0;
}
.cafe-card-addr svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; color: var(--brand); }
.cafe-card-addr span { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }

.cafe-card-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }
.cafe-card-actions .btn { flex: 1; }

/* ---------- Open badges ---------- */
.open-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.open-badge svg { width: 13px; height: 13px; }
.open-badge--open { color: var(--open); background: var(--open-bg); }
.open-badge--closed { color: var(--closed); background: var(--closed-bg); }
.open-badge--unknown { color: var(--ink-3); background: var(--unknown-bg); }

/* ============================================================
   Nearby split layout
   ============================================================ */
#view-nearby { height: calc(100vh - var(--nav-h)); overflow: hidden; }
.nearby-layout {
  position: relative;
  display: grid;
  grid-template-columns: 400px 1fr;
  height: 100%;
}

.list-panel {
  background: var(--bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.list-panel-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.list-panel-head h2 { font-size: 24px; letter-spacing: -0.02em; }
.list-head-controls { display: flex; align-items: center; gap: 8px; }
.sort-wrap {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 6px 8px 6px 10px;
  color: var(--ink-3);
}
.sort-wrap svg { width: 15px; height: 15px; }
#sort-select {
  border: 0; outline: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 600; font-size: 13px;
  cursor: pointer;
}
html[data-theme="dark"] #sort-select option { background: var(--surface); color: var(--ink); }

.list-panel-meta {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 20px;
  font-size: 12.5px;
  color: var(--ink-3);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}
.meta-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--brand);
  font-size: 12px; font-weight: 800;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.meta-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cafe-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.cafe-list::-webkit-scrollbar { width: 8px; }
.cafe-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
.cafe-list::-webkit-scrollbar-thumb:hover { background: var(--accent); }
.cafe-list .cafe-card { animation: none; flex-shrink: 0; }
.sheet-list .cafe-card { flex-shrink: 0; }

/* ---------- Map panel ---------- */
.map-panel { position: relative; min-height: 0; overflow: hidden; }
.map-canvas { position: absolute; inset: 0; }
.map-canvas:focus { outline: none; }

.map-loading {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  gap: 14px;
  background: var(--surface-2);
  z-index: 20;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
  align-content: center;
  text-align: center;
}
.map-loading.is-visible { opacity: 1; pointer-events: auto; }
.map-loading-text { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--ink-2); }
.coffee-spinner svg {
  width: 40px; height: 40px;
  color: var(--brand);
  animation: steam 1.6s ease-in-out infinite;
}
@keyframes steam {
  0%, 100% { transform: translateY(0) rotate(-4deg); opacity: 0.75; }
  50% { transform: translateY(-7px) rotate(4deg); opacity: 1; }
}

.map-pill {
  position: absolute;
  z-index: 10;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: var(--shadow-md);
  display: grid; place-items: center;
  transition: all var(--trans);
  backdrop-filter: blur(6px);
}
.map-pill svg { width: 18px; height: 18px; }
.map-pill:hover { color: var(--brand); transform: translateY(-2px); }
.map-pill--filter { top: 18px; left: 18px; }
.map-pill--recenter { top: 18px; left: 72px; }

.map-toggle {
  position: absolute;
  top: 18px; right: 18px;
  z-index: 10;
  display: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none;
  transform: translateY(-6px);
  transition: all var(--trans);
}
.map-toggle.is-visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.map-toggle-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 12.5px; font-weight: 700;
  padding: 7px 13px;
  border-radius: 999px;
  transition: all var(--trans);
}
.map-toggle-btn svg { width: 14px; height: 14px; }
.map-toggle-btn.is-active { background: var(--brand); color: #fff; box-shadow: var(--shadow-brand); }
html[data-theme="dark"] .map-toggle-btn.is-active { color: var(--brand-ink); }

/* ---------- Mobile sheet ---------- */
.mobile-sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  box-shadow: var(--shadow-lg);
  height: 55%;
  display: none;
  flex-direction: column;
  transition: height 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}
.sheet-grab {
  display: flex; justify-content: center;
  padding: 10px 0 4px;
  cursor: pointer;
  flex-shrink: 0;
}
.sheet-handle {
  width: 44px; height: 5px;
  border-radius: 999px;
  background: var(--line);
  transition: background var(--trans);
}
.sheet-grab:hover .sheet-handle { background: var(--accent); }
.sheet-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: none;
}
.sheet-list::-webkit-scrollbar { display: none; }
.mobile-sheet .cafe-card { animation: none; flex-direction: row; }
.mobile-sheet .cafe-card-media { flex: 0 0 108px; aspect-ratio: auto; }
.mobile-sheet .cafe-card-body { gap: 6px; padding: 12px 14px; }
.mobile-sheet .cafe-card-addr { display: none; }
.mobile-sheet .cafe-card-title { font-size: 15px; }
.mobile-sheet .dist-badge { display: none; }
.mobile-sheet .chip-mini { display: none; }
.mobile-sheet .media-topline { justify-content: flex-end; }
.mobile-sheet .fav-btn { width: 32px; height: 32px; }
.mobile-sheet .fav-btn svg { width: 15px; height: 15px; }
.mobile-sheet .cafe-card-actions {
  display: flex; gap: 6px;
  margin-top: auto; padding-top: 6px;
}
.mobile-sheet .cafe-card-actions .btn {
  flex: 1; padding: 7px 6px;
  font-size: 11px; border-radius: 9px; gap: 5px;
}
.mobile-sheet .cafe-card-actions .btn svg { width: 13px; height: 13px; }

/* Leaflet marker styling */
.cf-marker { background: transparent; border: 0; }
.cf-marker svg { display: block; filter: drop-shadow(0 3px 6px rgba(42, 27, 16, 0.35)); transition: transform 0.2s ease; }
.cf-marker.is-active svg { transform: scale(1.12) translateY(-2px); }
.cf-marker.is-hover:not(.is-active) svg { transform: scale(1.06); }
.cf-marker.is-bouncing svg { animation: markerBounce 0.7s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes markerBounce {
  0% { transform: translateY(0); }
  35% { transform: translateY(-14px); }
  60% { transform: translateY(0); }
  80% { transform: translateY(-6px); }
  100% { transform: translateY(0); }
}
.cf-you { background: transparent; border: 0; }
.cf-you svg { display: block; filter: drop-shadow(0 1px 4px rgba(37, 99, 235, 0.6)); }

/* Leaflet popup theming */
.leaflet-popup-content-wrapper {
  background: var(--surface) !important;
  color: var(--ink) !important;
  border: 1px solid var(--line);
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
}
.leaflet-popup-content { margin: 0 !important; width: auto !important; }
.leaflet-popup-tip { background: var(--surface) !important; border: 1px solid var(--line); border-top: 0; border-left: 0; }
.leaflet-container { font-family: var(--font-body); }

.map-infocard { width: 300px; }
.map-infocard-img {
  width: 100%; height: 120px;
  object-fit: cover;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

/* Google Maps InfoWindow theming */
.gm-style-iw-c { border-radius: var(--radius-md) !important; box-shadow: var(--shadow-lg) !important; padding: 0 !important; overflow: hidden; }
.gm-style-iw-d { overflow: visible !important; max-width: 300px !important; }
.gm-style-iw, .gm-style .gm-style-iw-c, .gm-style-iw-tc {
  background-color: var(--surface) !important;
}
.gm-style-iw-tc { filter: none; background: transparent !important; }
.gm-style-iw-tc::after { background: var(--surface) !important; border: 1px solid var(--line); border-top: 0; border-left: 0; }
.gm-style-iw.gm-style-iw-c { color: var(--ink); }
.map-infocard-body { padding: 14px; }
.map-infocard-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.map-infocard-head h4 { flex: 1; min-width: 0; font-size: 15.5px; font-weight: 700; overflow-wrap: anywhere; }
.map-infocard-head .open-badge { flex-shrink: 0; }
.map-infocard-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.map-infocard-meta .dist { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.map-infocard-meta .dist svg { width: 12px; height: 12px; }
.map-infocard-addr { font-size: 12.5px; color: var(--ink-3); margin-bottom: 12px; }
.map-infocard-actions { display: flex; gap: 6px; }
.map-infocard-actions .btn { flex: 1; }
.map-infocard-actions .btn--ghost { flex: 0 0 auto; padding: 8px 12px; }
.map-infocard-actions .is-fav svg { fill: currentColor; }

/* ============================================================
   Details modal
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  z-index: 1200;
  background: rgba(24, 13, 5, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.modal-overlay.is-open { opacity: 1; }
.modal-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  width: min(680px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  transform: translateY(26px) scale(0.98);
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: var(--shadow-lg);
  scrollbar-width: thin;
}
.modal-overlay.is-open .modal-panel { transform: translateY(0) scale(1); }

.details-hero {
  position: relative;
  height: 240px;
  overflow: hidden;
}
.details-hero img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.details-hero img.is-broken { display: none; }
.details-hero-fallback {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: rgba(255,255,255,0.9);
}
.details-hero-fallback svg { width: 64px; height: 64px; }
.details-hero-shade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20,10,4,0) 30%, rgba(20,10,4,0.72) 100%);
}
.details-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(20,10,4,0.35);
  backdrop-filter: blur(8px);
  color: #fff;
  display: grid; place-items: center;
  transition: all var(--trans);
  z-index: 5;
}
.details-close:hover { transform: rotate(90deg) scale(1.08); background: rgba(20,10,4,0.6); }
.details-close svg { width: 18px; height: 18px; }
.details-hero-title {
  position: absolute;
  left: 26px; right: 26px; bottom: 20px;
  z-index: 4;
}
.details-hero-title .chip-mini { color: #fff; background: rgba(20,10,4,0.4); border-color: rgba(255,255,255,0.2); }
.details-hero-title h2 {
  color: #fff;
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 10px;
  text-shadow: 0 2px 18px rgba(0,0,0,0.4);
}

.details-body { padding: 22px 26px 28px; }
.details-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}
.details-gallery img {
  width: 100%; height: 84px;
  object-fit: cover;
  border-radius: 12px;
  transition: transform var(--trans);
}
.details-gallery img:hover { transform: scale(1.04); }
.details-meta-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.rating--lg { gap: 4px; }
.rating--lg b { font-size: 22px; }
.price--lg { font-size: 17px; }
.dist-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 12.5px; font-weight: 700;
}
.dist-chip svg { width: 14px; height: 14px; color: var(--brand); }

.details-facts { display: grid; gap: 12px; margin: 18px 0 4px; }
.fact { display: flex; gap: 12px; align-items: flex-start; }
.fact > svg { width: 18px; height: 18px; color: var(--brand); flex-shrink: 0; margin-top: 2px; }
.fact-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); margin-bottom: 2px; }
.fact a { font-size: 14px; font-weight: 600; color: var(--ink); }
.fact a:hover { color: var(--brand); }

.details-section { margin-top: 22px; }
.details-section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px;
  margin-bottom: 12px;
  color: var(--ink);
}
.details-section-title svg { width: 16px; height: 16px; color: var(--brand); }

.hours-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.hours-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--ink-2);
}
.hours-list li.is-today {
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 700;
}
.hours-day { min-width: 86px; font-weight: 600; }
.hours-time { flex: 1; }
.hours-now { font-size: 11.5px; font-weight: 800; color: var(--open); }
.hours-empty { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 13.5px; }
.hours-empty svg { width: 15px; height: 15px; }

.attr-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.attr-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 12.5px; font-weight: 600;
  color: var(--ink-2);
}
.attr-chip svg { width: 14px; height: 14px; color: var(--brand); }

.details-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 24px;
}
.details-actions .btn { width: 100%; }
.btn--fav-lg { border-color: var(--line); color: var(--ink-2); background: var(--surface-2); }
.btn--fav-lg.is-fav { color: #fff; background: linear-gradient(135deg, #E0586B, #C24555); border-color: transparent; box-shadow: 0 8px 22px rgba(192, 69, 85, 0.35); }
.btn--fav-lg.is-fav svg { fill: currentColor; }

/* ============================================================
   Filter sheet
   ============================================================ */
#sheet-root { position: fixed; inset: 0; z-index: 1100; pointer-events: none; }
#sheet-root.sheet-is-open { pointer-events: auto; }
.filter-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(400px, 92vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  transform: translateX(105%);
  transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  pointer-events: auto;
}
#sheet-root.sheet-is-open .filter-panel { transform: translateX(0); }
.filter-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line-2);
}
.filter-head h3 { display: flex; align-items: center; gap: 10px; font-size: 19px; }
.filter-head h3 svg { width: 18px; height: 18px; color: var(--brand); }
.filter-body { flex: 1; overflow-y: auto; padding: 8px 22px 20px; }
.filter-group { padding: 16px 0; border-bottom: 1px solid var(--line-2); }
.filter-group h4 { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); margin-bottom: 10px; }
.opt-row {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-2);
  transition: color 0.15s ease;
}
.opt-row:hover { color: var(--ink); }
.opt-row input { position: absolute; opacity: 0; }
.opt-custom {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--line);
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.opt-row input:checked + .opt-custom { border-color: var(--brand); }
.opt-row input:checked + .opt-custom::after {
  content: '';
  position: absolute; inset: 3px;
  border-radius: 50%;
  background: var(--brand);
  animation: dotIn 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes dotIn { from { transform: scale(0.4); } to { transform: scale(1); } }
.opt-row input:checked ~ .opt-label { color: var(--ink); }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 0;
  cursor: pointer;
}
.toggle-text strong { display: block; font-size: 14.5px; }
.toggle-text span { font-size: 12.5px; color: var(--ink-3); }
.toggle-row input { position: absolute; opacity: 0; }
.toggle {
  position: relative;
  width: 46px; height: 27px;
  border-radius: 999px;
  background: var(--line);
  transition: background 0.25s ease;
  flex-shrink: 0;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 21px; height: 21px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.toggle-row input:checked + .toggle { background: var(--brand); }
.toggle-row input:checked + .toggle::after { transform: translateX(19px); }

.filter-foot {
  display: flex; gap: 10px;
  padding: 16px 22px 22px;
  border-top: 1px solid var(--line-2);
}
.filter-foot .btn { flex: 1; }

/* ============================================================
   Favorites
   ============================================================ */
.page-head { padding: 44px 24px 8px; text-align: center; }
.page-title { font-size: clamp(30px, 4.5vw, 42px); letter-spacing: -0.025em; }
.page-title em { font-style: italic; color: var(--brand); }
.page-sub { color: var(--ink-3); margin-top: 8px; font-size: 15px; }
.favorites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}

/* ============================================================
   About
   ============================================================ */
.about { padding-bottom: 60px; }
.about-hero { text-align: center; padding: 64px 0 36px; max-width: 720px; }
.about-lead {
  color: var(--ink-2);
  font-size: 17px;
  margin-top: 14px;
  line-height: 1.65;
}
.demo-banner {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--accent-soft);
  border: 1px solid rgba(193, 133, 59, 0.3);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin: 8px auto 32px;
  max-width: 760px;
}
.demo-banner > svg { width: 22px; height: 22px; color: var(--brand); flex-shrink: 0; margin-top: 2px; }
.demo-banner strong { font-size: 14px; }
.demo-banner p { font-size: 13px; color: var(--ink-2); margin-top: 4px; line-height: 1.55; }
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  transition: all var(--trans);
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: rgba(193, 133, 59, 0.4); }
.feature-icon {
  width: 46px; height: 46px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--brand);
  display: grid; place-items: center;
  margin-bottom: 16px;
}
.feature-icon svg { width: 22px; height: 22px; }
.feature-card h3 { font-size: 17px; margin-bottom: 8px; }
.feature-card p { font-size: 13.5px; color: var(--ink-2); line-height: 1.6; }

.journey { max-width: 760px; margin: 48px auto 0; }
.journey h2 { text-align: center; font-size: 28px; margin-bottom: 24px; }
.journey-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; counter-reset: step; }
.journey-steps li {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  font-weight: 600;
  font-size: 14.5px;
  color: var(--ink-2);
}
.journey-steps li span {
  width: 32px; height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--brand);
  color: var(--brand-ink);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
}
html[data-theme="dark"] .journey-steps li span { color: var(--brand-ink); }
.about-foot { text-align: center; margin-top: 56px; color: var(--ink-3); font-size: 13.5px; }
.about-foot svg { width: 14px; height: 14px; vertical-align: -2px; color: var(--brand); }
.about-dev { margin-top: 8px; font-weight: 700; color: var(--ink-2); }

/* ============================================================
   Location overlay
   ============================================================ */
.location-overlay {
  position: fixed; inset: 0;
  z-index: 1300;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(24, 13, 5, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.location-overlay.is-open { opacity: 1; }
.location-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 40px 34px 28px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  transform: translateY(24px) scale(0.98);
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}
.location-overlay.is-open .location-card { transform: translateY(0) scale(1); }
.location-overlay .location-card.is-busy { pointer-events: none; }
.location-art {
  position: relative;
  width: 84px; height: 84px;
  margin: 0 auto 22px;
  display: grid; place-items: center;
  color: var(--brand);
}
.location-art > svg { width: 40px; height: 40px; z-index: 2; filter: drop-shadow(0 4px 10px rgba(193,133,59,0.5)); }
.loc-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  animation: ping 2.2s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.loc-ring--1 { inset: 0; }
.loc-ring--2 { inset: 0; animation-delay: 1.1s; }
@keyframes ping {
  0% { transform: scale(0.75); opacity: 0.55; }
  80%, 100% { transform: scale(1.75); opacity: 0; }
}
.location-card h2 { font-size: 26px; letter-spacing: -0.02em; }
.location-card > p { color: var(--ink-2); font-size: 14.5px; margin-top: 10px; line-height: 1.6; }
.location-actions { display: grid; gap: 12px; margin-top: 26px; }
.location-note {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 12px; color: var(--ink-3);
  margin-top: 18px;
}
.location-note svg { width: 14px; height: 14px; color: var(--open); }

/* ============================================================
   Toasts
   ============================================================ */
.toast-root {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  z-index: 1400;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
  width: min(460px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 14px;
  padding: 13px 18px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(14px) scale(0.96);
  transition: all 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: auto;
  cursor: pointer;
  max-width: 100%;
}
.toast.is-visible { opacity: 1; transform: translateY(0) scale(1); }
.toast svg { width: 17px; height: 17px; flex-shrink: 0; }
.toast--success svg { color: var(--open); }
.toast--error svg { color: var(--closed); }
.toast--info svg { color: var(--accent); }
.toast span { overflow: hidden; text-overflow: ellipsis; }

/* ============================================================
   States (empty / error / skeleton)
   ============================================================ */
.state-card {
  text-align: center;
  padding: 56px 24px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  grid-column: 1 / -1;
}
.state-icon {
  width: 64px; height: 64px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--ink-3);
  display: grid; place-items: center;
}
.state-icon svg { width: 28px; height: 28px; }
.state-title { font-size: 20px; }
.state-text { color: var(--ink-3); max-width: 420px; margin: 8px auto 20px; font-size: 14px; }
.state-action { margin-top: 4px; }

.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.skeleton-block {
  position: relative;
  background: var(--surface-3);
  border-radius: 8px;
  overflow: hidden;
}
.skeleton-block::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.45), transparent);
  animation: shimmer 1.4s infinite;
}
html[data-theme="dark"] .skeleton-block::after {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.skeleton-img { aspect-ratio: 16/9.5; border-radius: 0; }
.skeleton-card-body { padding: 16px; display: grid; gap: 12px; }

/* ============================================================
   Bottom nav (mobile)
   ============================================================ */
#bottom-nav-root {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 950;
  background: var(--nav-bg);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bnav-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 560px;
  margin: 0 auto;
}
.bnav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 4px 8px;
  border: 0; background: none;
  color: var(--ink-3);
  font-size: 10.5px; font-weight: 700;
  transition: color 0.2s ease;
}
.bnav-item svg { width: 21px; height: 21px; transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1); }
.bnav-item.is-active { color: var(--brand); }
.bnav-item.is-active svg { transform: translateY(-2px); filter: drop-shadow(0 3px 6px rgba(193,133,59,0.4)); }

/* Marker cluster badge */
.cf-cluster { background: transparent; border: 0; }
.cf-cluster svg { display: block; filter: drop-shadow(0 4px 8px rgba(42, 27, 16, 0.4)); }

/* ============================================================
   Floating café card (map place preview)
   ============================================================ */
.map-card {
  position: absolute;
  z-index: 40;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  width: min(380px, calc(100vw - 32px));
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  opacity: 0;
  transform: translateX(-50%) translateY(24px);
  transition: opacity 0.26s ease, transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}
.map-card.is-open { opacity: 1; transform: translateX(-50%) translateY(0); }
.map-card.is-hidden { display: none; }

.map-card-close, .map-card-fav {
  position: absolute;
  top: 12px;
  z-index: 5;
  width: 44px; height: 44px;
  min-width: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(20, 10, 4, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  display: grid; place-items: center;
  transition: all var(--trans);
}
.map-card-close { right: 12px; }
.map-card-fav { left: 12px; }
.map-card-close:hover, .map-card-fav:hover { background: rgba(20, 10, 4, 0.62); transform: scale(1.05); }
.map-card-close:active, .map-card-fav:active { transform: scale(0.92); }
.map-card-close svg, .map-card-fav svg { width: 18px; height: 18px; }
.map-card-fav.is-fav { color: #fff; background: linear-gradient(135deg, #E0586B, #C24555); border-color: transparent; }
.map-card-fav.is-fav svg { fill: currentColor; animation: heartPop 0.5s cubic-bezier(0.22, 1, 0.36, 1); }

.map-card-media {
  position: relative;
  height: 150px;
  background: var(--surface-3);
}
.map-card-media img { width: 100%; height: 100%; object-fit: cover; }
.map-card-media img.is-broken { display: none; }
.map-card-media .media-fallback {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--ink-3);
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
}
.map-card-media .media-fallback svg { width: 40px; height: 40px; }

.map-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.map-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.map-card-title-wrap { min-width: 0; flex: 1; }
.map-card-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.map-card-cat {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.map-card-meta { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-2); flex-wrap: wrap; }
.map-card-meta .rating { font-size: 14px; }
.map-card-meta .rating b { font-size: 14.5px; }
.map-card-meta .star-ic { width: 15px; height: 15px; }
.map-card-sep { color: var(--ink-3); }
.map-card-dist { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.map-card-dist svg { width: 13px; height: 13px; color: var(--brand); }
.map-card-addr {
  font-size: 13px;
  color: var(--ink-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.map-card-actions {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  grid-template-columns: 1fr 1fr;
  grid-template-areas: "details directions";
}
.map-card-btn-details { grid-area: details; }
.map-card-actions [data-action="directions"] { grid-area: directions; }
.map-card-actions .btn { min-height: 46px; border-radius: 14px; font-size: 14px; gap: 6px; }
.map-card-actions .btn svg { width: 16px; height: 16px; }
.map-card-actions .btn:active { transform: scale(0.97); }

/* Skeleton loading */
.map-card-skeleton { display: flex; flex-direction: column; }
.map-card-sk {
  position: relative;
  overflow: hidden;
  background: var(--surface-3);
  border-radius: 8px;
}
.map-card-sk::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  animation: shimmer 1.4s infinite;
}
html[data-theme="dark"] .map-card-sk::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
}
.map-card-sk-img { height: 150px; border-radius: 0; }
.map-card-sk-body { padding: 16px; display: grid; gap: 10px; }
.map-card-sk-line { height: 14px; }
.map-card-sk-btn { height: 46px; border-radius: 14px; }
.map-card-sk .w-45 { width: 45%; }
.map-card-sk .w-75 { width: 75%; }
.map-card-sk .w-90 { width: 90%; }

/* ============================================================
   Bottom sheet (full details, mobile)
   ============================================================ */
.modal-overlay--sheet { padding: 0; align-items: flex-end; }
.modal-panel--sheet {
  width: 100%;
  max-width: 560px;
  border-radius: 22px 22px 0 0;
  max-height: 92dvh;
  align-self: flex-end;
  transform: translateY(100%);
  box-shadow: 0 -18px 50px rgba(42, 27, 16, 0.22);
  border-bottom: 0;
}
.modal-overlay.is-open .modal-panel--sheet { transform: translateY(0) scale(1); }
.modal-panel--sheet::before {
  content: '';
  display: block;
  width: 44px; height: 5px;
  margin: 10px auto 2px;
  border-radius: 999px;
  background: var(--line);
}
.modal-panel--sheet .details-hero { height: 180px; }
.modal-panel--sheet .details-actions .btn { min-height: 48px; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1023px) {
  .nav-links { display: none; }
  .nav-actions { gap: 6px; }

  #view-nearby { height: calc(100dvh - var(--nav-h)); }
  .nearby-layout {
    display: block;
  }
  .map-panel {
    position: absolute;
    inset: 0;
    transition: clip-path 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    clip-path: inset(0 0 45% 0);
  }
  .nearby-layout.list-dominant .map-panel { clip-path: inset(0 0 68% 0); }
  .nearby-layout.map-dominant .map-panel { clip-path: inset(0 0 0 0); }
  .list-panel { display: none; }

  .mobile-sheet {
    display: flex;
    height: 45%;
    transition: height 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .mobile-sheet.is-collapsed { display: none; }
  .nearby-layout.map-dominant .mobile-sheet { display: none; }
  .nearby-layout.list-dominant .mobile-sheet { height: 66%; }

  .map-toggle { display: flex; position: absolute; top: calc(env(safe-area-inset-top, 0px) + 18px); right: 12px; }
  .map-toggle-btn span { display: none; }
  .map-toggle-btn { padding: 9px 13px; }

  #bottom-nav-root { display: block; }
  .app-shell { padding-bottom: 64px; }
  #view-nearby { height: calc(100dvh - var(--nav-h) - 64px); }
  .mobile-sheet { border-radius: 22px 22px 0 0; }

  /* Map pills replaced by the Map/List toggle */
  .map-pill { display: none; }

  /* Hide the sheet while the place card is open so it never overlaps */
  .nearby-layout.map-card-open .mobile-sheet { display: none; }
}

@media (max-width: 640px) {
  .container { padding-left: 16px; padding-right: 16px; }
  body { font-size: 14px; }
  .hero { padding: 56px 16px 32px; }
  .hero-content { max-width: 100%; }
  .search-bar { padding: 6px 6px 6px 14px; border-radius: 20px; }
  .btn--search span { display: none; }
  .btn--search { padding: 11px 13px; border-radius: 16px; }
  .results-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .results-head-actions { width: 100%; }
  .results-head-actions .btn { flex: 1; }
  .cafe-grid { grid-template-columns: 1fr; gap: 16px; }

  /* Smaller card text so buttons + names fit */
  .cafe-card-title {
    display: block;
    -webkit-line-clamp: unset;
    -webkit-box-orient: initial;
    overflow: visible;
  }
  .cafe-card-addr { font-size: 12px; }
  .cafe-card-addr span { display: block; -webkit-line-clamp: unset; overflow: visible; }
  .cafe-card-meta .rating { font-size: 12px; }
  .rating b { font-size: 13px; }
  .reviews { font-size: 11.5px; }
  .cafe-card-actions .btn { font-size: 11.5px; padding: 8px 10px; }
  .chip-mini { font-size: 10.5px; padding: 4px 9px; }
  .dist-badge { font-size: 10.5px; padding: 4px 8px; }
  .open-badge { font-size: 10.5px; padding: 4px 8px; }
  .favorites-grid .cafe-card-actions { flex-wrap: wrap; }
  .favorites-grid .cafe-card-actions .btn { flex: 1 1 30%; }

  .modal-overlay { padding: 10px; }
  .modal-panel { border-radius: var(--radius-lg); max-height: 94vh; }
  .details-hero { height: 190px; }
  .details-body { padding: 18px; }
  .details-gallery { grid-template-columns: repeat(3, 1fr); }
  .details-gallery img { height: 62px; }
  .details-actions { grid-template-columns: 1fr; }

  .page-head { padding: 36px 16px 0; }
  .favorites-grid { grid-template-columns: 1fr; padding: 22px 16px 60px; }

  .mobile-sheet .cafe-card-media { flex: 0 0 96px; }
  .mobile-sheet .fav-btn { width: 28px; height: 28px; }
  .mobile-sheet .cafe-card-title { font-size: 14px; }
  .mobile-sheet .cafe-card-body { padding: 10px 12px; gap: 4px; }
  .mobile-sheet .open-badge { padding: 4px 8px; font-size: 10.5px; }
  .mobile-sheet .cafe-card-meta { gap: 6px; }

  .filter-panel { width: 92vw; border-radius: var(--radius-lg) 0 0 var(--radius-lg); }

  .map-infocard { width: 250px; max-height: 60vh; overflow-y: auto; }
  .map-infocard-img { height: 90px; }
  .map-infocard-body { padding: 10px 12px; }
  .map-infocard-head { margin-bottom: 4px; }
  .map-infocard-head h4 { font-size: 13.5px; }
  .map-infocard-meta { gap: 8px; margin-bottom: 4px; }
  .map-infocard-addr { font-size: 11.5px; margin-bottom: 8px; }
  .map-infocard-actions { gap: 5px; }
  .map-infocard .btn { font-size: 11px; padding: 7px 8px; }

  /* Mobile place card sizing */
  .map-card { bottom: 12px; }
  .map-card-media { height: 132px; }
  .map-card-title { font-size: 17.5px; }
  .map-card-addr { font-size: 12.5px; }
  .map-card-actions .btn { min-height: 44px; font-size: 13.5px; }
  .map-card-sk-img { height: 132px; }

  /* Bottom sheet details on phones */
  .modal-panel--sheet { max-height: 92dvh; border-radius: 20px 20px 0 0; }
  .modal-panel--sheet .details-hero { height: 165px; }
  .modal-panel--sheet .details-actions .btn { min-height: 48px; font-size: 14px; }
}

@media (max-width: 400px) {
  .map-card-media { height: 118px; }
  .map-card-sk-img { height: 118px; }
  .map-card-title { font-size: 16.5px; }
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}