:root {
  --paper: #fff6eb;
  --paper-deep: #f3e5d5;
  --card: #fffcf7;
  --ink: #22151a;
  --muted: #6c5c58;
  --line: #ecdccb;
  --terra: #6e001d;
  --terra-deep: #6e001d;
  --sage: #495938;
  --sage-soft: #e3e8d5;
  --petrol: #00536e;
  --rose: #f57d9c;
  --rose-soft: #fde2e9;
  --gold: #c4922a;
  --star-empty: #ecdccb;
  --shadow: 0 18px 44px rgba(60, 20, 28, 0.08);
  --route: #00536e;
  --pulse: rgba(245, 125, 156, 0.55);
  --btn: #6e001d;
  --btn-text: #fff6eb;
  --chip: #fffcf7;
  --chip-on-text: #fff6eb;
  --you: #00536e;
  --dot-selected: #f57d9c;
  --header: rgba(255, 246, 235, 0.88);
  color-scheme: light;
}

:root[data-theme="abend"] {
  --paper: #170f11;
  --paper-deep: #22171a;
  --card: #281b1e;
  --ink: #fff6eb;
  --muted: #c4b0a9;
  --line: #3e2c2f;
  --terra: #f57d9c;
  --terra-deep: #fbb6c8;
  --sage: #a8b98a;
  --sage-soft: #2a3220;
  --petrol: #5fb6d4;
  --rose: #f57d9c;
  --rose-soft: #4a2230;
  --gold: #e4c48a;
  --star-empty: #3e2c2f;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.4);
  --route: #5fb6d4;
  --pulse: rgba(245, 125, 156, 0.5);
  --btn: #f57d9c;
  --btn-text: #3a0010;
  --chip: #2c1f22;
  --chip-on-text: #1d2414;
  --you: #5fb6d4;
  --dot-selected: #fff6eb;
  --header: rgba(23, 15, 17, 0.9);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(920px 420px at 100% -10%, color-mix(in srgb, var(--rose) 30%, transparent), transparent 62%),
    radial-gradient(720px 340px at -10% 4%, color-mix(in srgb, var(--sage) 20%, transparent), transparent 58%),
    var(--paper);
  color: var(--ink);
  font-family: "Outfit", "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.5;
}

:root[data-theme="abend"] body {
  background:
    radial-gradient(800px 320px at 100% -10%, color-mix(in srgb, #6e001d 55%, transparent), transparent 62%),
    radial-gradient(640px 280px at -8% 0%, color-mix(in srgb, #00536e 30%, transparent), transparent 58%),
    var(--paper);
}

h1, h2, h3, p { margin: 0; }

h1, h2, h3, .brand-name, .cafe-name, .nearest-name {
  font-family: "Fraunces", Georgia, serif;
  font-optical-sizing: auto;
  font-weight: 560;
  letter-spacing: -0.03em;
}

a { color: var(--terra-deep); }

button, input, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 20;
  background: var(--card);
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 999px;
}

.skip:focus { top: 12px; }

.wrap {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--header);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.logo {
  width: 46px;
  height: 46px;
  color: var(--terra);
  flex: none;
}

:root[data-theme="abend"] .logo { color: var(--terra); }

.brand-text { display: flex; flex-direction: column; line-height: 1.1; }

.brand-name { font-size: 1.25rem; }

.brand-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.01em;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.draft-pill {
  border: 1px dashed var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.draft-switch {
  display: flex;
  padding: 3px;
  background: var(--paper-deep);
  border-radius: 999px;
}

.draft-switch a {
  display: grid;
  place-items: center;
  min-width: 36px;
  min-height: 36px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}

.draft-switch a[aria-current="page"] {
  background: var(--btn);
  color: var(--btn-text);
}

.theme-switch {
  display: flex;
  padding: 3px;
  background: var(--paper-deep);
  border-radius: 999px;
}

.theme-switch button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  min-height: 36px;
  padding: 0 12px;
}

.theme-switch button[aria-pressed="true"] {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.intro { padding: 28px 0 8px; }

.eyebrow {
  color: var(--terra-deep);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  max-width: 14ch;
  margin-top: 6px;
  font-size: clamp(2.4rem, 5vw, 4.3rem);
  line-height: 0.98;
}

.lead {
  max-width: 38rem;
  margin-top: 14px;
  color: var(--muted);
  font-size: 1.05rem;
}

.locate {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  padding: 6px 6px 6px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.locate input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 10px 0;
  outline: none;
}

.locate input::placeholder { color: var(--muted); }

.locate-actions { display: flex; gap: 8px; }

.btn, .btn-ghost, .text-btn {
  border-radius: 999px;
  min-height: 44px;
  padding: 0 16px;
  font-weight: 600;
}

.btn {
  border: 0;
  background: var(--btn);
  color: var(--btn-text);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn:disabled { opacity: 0.6; cursor: wait; }

.text-btn {
  border: 0;
  background: transparent;
  color: var(--terra-deep);
  padding-inline: 0;
  min-height: 36px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--ink);
}

.chip-count {
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.chip[aria-pressed="true"] {
  background: var(--sage);
  border-color: var(--sage);
  color: var(--chip-on-text);
}

.chip[aria-pressed="true"] .chip-count { color: inherit; opacity: 0.8; }

.fine-print {
  margin-top: 10px;
  max-width: 62rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 22px;
  align-items: start;
  margin-top: 18px;
}

.map-panel {
  position: sticky;
  top: 92px;
  height: auto;
}

#map {
  height: 540px;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
  background: transparent;
}

.legend { display: none; }

.legend {
  display: none;
  position: absolute;
  z-index: 500;
  left: 14px;
  bottom: 14px;
  gap: 14px;
  margin: 0;
  padding: 8px 14px;
  list-style: none;
  background: color-mix(in srgb, var(--card) 86%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  border-radius: 999px;
  font-size: 0.76rem;
  letter-spacing: 0.01em;
  color: var(--muted);
  box-shadow: 0 8px 24px rgba(28, 22, 16, 0.06);
}

.map-panel { position: sticky; }

.legend li { display: flex; align-items: center; gap: 6px; }

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.swatch-cafe { background: var(--terra); }
.swatch-near { background: var(--terra); box-shadow: 0 0 0 3px var(--pulse); }
.swatch-you { background: var(--you); }

.leaflet-container { font: inherit; background: var(--paper); }

.city-mask {
  fill: var(--paper-deep) !important;
  stroke: none !important;
  fill-opacity: .74 !important;
}

.leaflet-control-zoom.leaflet-bar {
  border: 1px solid var(--line) !important;
  border-radius: 14px !important;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(34, 21, 26, .12) !important;
}

.leaflet-control-zoom a,
.leaflet-control-zoom a:hover {
  width: 36px !important;
  height: 36px !important;
  line-height: 34px !important;
  background: var(--card) !important;
  color: var(--terra) !important;
  border-color: var(--line) !important;
  font-family: inherit !important;
  font-size: 20px !important;
  font-weight: 500 !important;
}

.leaflet-control-zoom a:hover { background: var(--rose-soft) !important; }
.leaflet-control-zoom a.leaflet-disabled { color: var(--muted) !important; opacity: .5; }

.city-outline {
  fill: none !important;
  stroke: var(--terra) !important;
  stroke-width: 3px !important;
  stroke-linejoin: round !important;
}

.leaflet-tile-pane {
  filter: saturate(1.25) contrast(1.05) brightness(1.02);
}

:root[data-theme="abend"] .leaflet-tile-pane {
  filter: invert(0.88) hue-rotate(168deg) saturate(0.85) brightness(0.92) contrast(1.06);
}

.leaflet-top.leaflet-right { margin-top: 14px; margin-right: 14px; }

.leaflet-bar {
  border: 0 !important;
  border-radius: 16px !important;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(28, 22, 16, 0.14);
}

.leaflet-bar a {
  background: color-mix(in srgb, var(--card) 92%, transparent) !important;
  color: var(--ink) !important;
  border-bottom-color: var(--line) !important;
  width: 36px !important;
  height: 36px !important;
  line-height: 36px !important;
}

.leaflet-bar a:hover { background: var(--paper-deep) !important; }

.leaflet-control-attribution {
  background: color-mix(in srgb, var(--card) 78%, transparent) !important;
  color: var(--muted) !important;
  font-size: 10px !important;
  max-width: 42%;
  margin-right: 0 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 10px 0 0 0;
  backdrop-filter: blur(8px);
}

.leaflet-control-attribution a { color: var(--ink) !important; }

.cafe-dot, .user-dot { background: transparent !important; border: 0 !important; }

.dot, .user-dot .core {
  display: block;
  width: 12px;
  height: 12px;
  margin: 5px;
  border-radius: 50%;
  background: var(--terra);
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(36, 24, 16, 0.28), 0 0 0 1px rgba(36, 24, 16, 0.05);
}

.cafe-dot.is-selected .dot {
  background: var(--dot-selected);
  border-color: var(--card);
  transform: scale(1.25);
}

.cafe-dot.is-nearest .dot { box-shadow: 0 0 0 7px var(--pulse), 0 2px 8px rgba(36, 24, 16, 0.2); }

.user-dot { position: relative; }

.user-dot .core {
  background: var(--you);
  margin: 0;
  position: absolute;
  left: 5px;
  top: 5px;
}

.notice, .count { color: var(--muted); font-size: 0.92rem; }

.notice { margin-bottom: 8px; }

.nearest {
  display: grid;
  gap: 2px;
  margin-bottom: 12px;
  padding: 14px 16px;
  background: var(--sage-soft);
  border-radius: 18px;
}

.nearest-name {
  justify-self: start;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 1.7rem;
  color: var(--ink);
  text-align: left;
}

.count { margin: 4px 0 12px; }

.cafe-list-empty {
  padding: 22px 8px 8px;
}

.cafe-list-empty h2 {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.cafe-list-empty p { color: var(--muted); margin-bottom: 14px; }

.cafe-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  margin-bottom: 12px;
}

.cafe-card.is-selected {
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--terra);
}

.cafe-head {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  padding: 14px 16px;
  border: 0;
  background: transparent;
  text-align: left;
  border-radius: 20px;
}

.cafe-name { font-size: 1.35rem; line-height: 1.15; }

.cafe-meta, .cafe-hours-line { color: var(--muted); font-size: 0.92rem; }

.rating-block { text-align: right; white-space: nowrap; }

.cafe-card { scroll-margin-top: 104px; }

.catalog { margin-top: 42px; }

.catalog h2 { font-size: clamp(1.8rem, 3vw, 2.5rem); margin-bottom: 6px; }

.catalog-note {
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 16px;
}

#cafe-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  scroll-margin-top: 104px;
}

.tile:hover, .cafe-card:hover { border-color: var(--rose); }

.tile.is-selected {
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--terra);
}

.tile.is-open { grid-column: 1 / -1; }

.tile-head {
  width: 100%;
  display: flex;
  flex-direction: column;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
  color: inherit;
  border-radius: 22px;
}

.tile.is-open .tile-head { flex-direction: row; align-items: stretch; }

.tile-photo {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--paper-deep);
}

.tile.is-open .tile-photo {
  width: min(42%, 360px);
  aspect-ratio: auto;
  min-height: 220px;
  flex: none;
}

.tile-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  padding: 14px 16px 16px;
}

.tile .cafe-name { font-size: 1.28rem; }

.rating-score {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.rating-count, .distance {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.distance { margin-top: 4px; color: var(--sage); font-weight: 600; }

.tag-row {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag, .state-pill, .sample-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--paper-deep);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.tag.is-active {
  background: var(--sage-soft);
  color: var(--sage);
}

.state-pill.is-open { background: var(--sage-soft); color: var(--sage); }
.state-pill.is-closed { background: var(--paper-deep); color: var(--muted); }
.state-pill.is-unknown { background: transparent; border: 1px solid var(--line); }

.cafe-body { padding: 0 16px 16px; }

.blurb { margin-bottom: 12px; }

.links { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 14px; }

.links a { font-weight: 600; text-underline-offset: 3px; }

.hours {
  display: grid;
  grid-template-columns: 2.2rem 1fr;
  gap: 3px 10px;
  margin: 0 0 16px;
  font-size: 0.92rem;
}

.hours dt { color: var(--muted); }
.hours div { display: contents; }
.hours .is-today dt, .hours .is-today dd { color: var(--sage); font-weight: 600; }
.hours dd { margin: 0; }

.google-box, .guestbook {
  margin-top: 8px;
  padding: 14px;
  border-radius: 16px;
}

.google-box {
  background: var(--paper);
  border: 1px solid var(--line);
}

.google-box h3, .guestbook h3 { font-size: 1.15rem; margin-bottom: 6px; }

.source-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}

.stars {
  position: relative;
  display: inline-block;
  font-family: "Segoe UI Symbol", "Segoe UI", sans-serif;
  font-size: 0.95rem;
  letter-spacing: 1px;
  line-height: 1;
}

.stars-base { color: var(--star-empty); }

.stars-fill {
  position: absolute;
  left: 0;
  top: 0;
  overflow: hidden;
  white-space: nowrap;
  color: var(--gold);
}

.google-note { color: var(--muted); font-size: 0.88rem; margin-bottom: 8px; }

.guestbook h3 { outline: none; }

.guest-note { color: var(--muted); font-size: 0.88rem; margin-bottom: 10px; }

.comment { padding: 10px 0; border-top: 1px solid var(--line); }

.comment-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.comment-name { font-weight: 600; }

.comment time, .comment-tools { color: var(--muted); font-size: 0.8rem; }

.comment p { margin-top: 4px; }

.comment-form { display: grid; gap: 8px; margin-top: 12px; }

.comment-form label { display: grid; gap: 4px; font-size: 0.88rem; font-weight: 600; }

.comment-form input, .comment-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 400;
}

.comment-form textarea { min-height: 88px; resize: vertical; }

.form-error { color: var(--terra-deep); font-size: 0.86rem; min-height: 1.2em; }

.form-row { display: flex; justify-content: flex-end; }

.site-footer {
  margin-top: 48px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper-deep) 65%, transparent);
}

.footer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 22px 0 28px;
}

.footer-brand {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.15rem;
  color: var(--ink);
}

.footer-nav { display: flex; flex-wrap: wrap; gap: 8px 16px; }

.footer-nav a {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

.footer-nav a:hover,
.footer-nav a[aria-current="page"] { color: var(--ink); }

.site-footer p { margin: 0; color: var(--muted); font-size: 0.88rem; }

.legal {
  width: min(760px, calc(100% - 32px));
  margin: 40px auto 72px;
}

.legal h1 {
  max-width: none;
  font-size: clamp(2.2rem, 4vw, 3.3rem);
}

.legal h2 { font-size: 1.35rem; margin-top: 1.8rem; }

.legal p,
.legal li { margin-top: 0.75rem; }

.legal ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }

.legal a { color: var(--petrol); }

.legal table {
  width: 100%;
  margin-top: 16px;
  border-collapse: collapse;
}

.legal th,
.legal td {
  padding: 10px 16px 10px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.legal th {
  width: 11.5rem;
  color: var(--muted);
  font-weight: 600;
}

:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: no-preference) {
  .cafe-dot.is-nearest .dot { animation: pulse 2.2s ease-out infinite; }
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 var(--pulse); }
  100% { box-shadow: 0 0 0 12px transparent; }
}

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  #cafe-list { grid-template-columns: 1fr 1fr; }
  .map-panel {
    position: relative;
    top: auto;
    height: auto;
  }
  #map { height: 420px; }
  h1 { max-width: none; }
}

@media (max-width: 680px) {
  .header-inner { min-height: 68px; }
  .brand-sub, .draft-pill { display: none; }
  .header-tools { gap: 6px; }
  .draft-switch a { min-width: 32px; min-height: 34px; }
  .theme-switch button { min-height: 34px; padding: 0 10px; }
  .locate {
    flex-wrap: wrap;
    border-radius: 22px;
    padding: 8px;
  }
  .locate input { flex: 1 0 100%; padding: 10px; }
  .locate-actions { width: 100%; }
  .locate-actions .btn, .locate-actions .btn-ghost { flex: 1; }
  .legend { max-width: calc(100% - 24px); flex-wrap: wrap; border-radius: 16px; bottom: 26px; }
  .map-panel { height: auto; }
  #map { height: 360px; }
  #cafe-list { grid-template-columns: 1fr; }
  .tile.is-open .tile-head { flex-direction: column; }
  .tile.is-open .tile-photo { width: 100%; min-height: 0; aspect-ratio: 16 / 10; }
}

@media (max-width: 440px) {
  .brand-text { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
