/* Jax Eats — warm, paper-like, legible in both themes. */
:root {
  --bg: #faf6f0;
  --surface: #fffdfa;
  --surface-2: #f3ece2;
  --border: #e2d6c6;
  --text: #2b241d;
  --muted: #7c6f61;
  --accent: #b6462a;
  --accent-soft: #f4e3dd;
  --good: #3f7a4d;
  --shadow: 0 1px 2px rgba(43, 36, 29, .06), 0 4px 16px rgba(43, 36, 29, .05);
  --radius: 12px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17130f; --surface: #211b16; --surface-2: #2b231c; --border: #3a3028;
    --text: #f0e7dc; --muted: #a39483; --accent: #e87355; --accent-soft: #3a241d;
    --good: #6fae7d;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* header */
header.site { border-bottom: 1px solid var(--border); background: var(--surface); }
header.site .wrap { display: flex; align-items: baseline; gap: 16px; padding-top: 22px; padding-bottom: 22px; flex-wrap: wrap; }
h1.logo { font-family: var(--serif); font-size: 30px; margin: 0; letter-spacing: -.01em; }
h1.logo a { color: inherit; text-decoration: none; }
.tagline { color: var(--muted); font-size: 14px; margin: 0; }
header.site nav { margin-left: auto; display: flex; gap: 16px; font-size: 14px; }
header.site nav a { color: var(--muted); text-decoration: none; }
header.site nav a:hover, header.site nav a.active { color: var(--accent); }

/* `.wrap` outranks a bare `main`, so this needs the class to actually apply. */
main.wrap { padding: 32px 20px 64px; }

/* controls */
.controls { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; align-items: center; }
input, select, textarea, button {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible,
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
textarea { width: 100%; resize: vertical; min-height: 80px; font-family: inherit; }
.search { flex: 1 1 220px; min-width: 180px; }
button { cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.ghost { background: transparent; }
button.danger { color: var(--accent); }

.count { color: var(--muted); font-size: 14px; margin: 0 0 14px; }

/* cards */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); position: relative;
}
.card.closed { opacity: .62; }
.card h3 { font-family: var(--serif); font-size: 20px; margin: 0 0 2px; line-height: 1.25; }
.meta { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.meta a { color: inherit; }
.rating { font-weight: 700; color: var(--accent); font-size: 15px; white-space: nowrap; }
.rating .out { color: var(--muted); font-weight: 400; font-size: 12px; }
.card .top { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.review { margin: 10px 0 0; font-size: 14.5px; }
.dishes { margin: 8px 0 0; font-size: 13.5px; color: var(--muted); }
.dishes b { color: var(--text); font-weight: 600; }
/* Address and phone links: default browser blue is the loudest thing on the
   card and fights the palette. Underlined but in the card's own colour. */
.dishes a { color: var(--muted); text-decoration-color: var(--border); }
.dishes a:hover { color: var(--accent); text-decoration-color: currentColor; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag {
  font-size: 11.5px; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.tag.status-want { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }
.tag.ret-yes { color: var(--good); }
.tag.rec { border-style: dashed; }
.empty { text-align: center; color: var(--muted); padding: 60px 20px; font-family: var(--serif); font-size: 18px; }

/* map */
#map { height: 460px; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 24px; box-shadow: var(--shadow); }

/* Leaflet paints its container #ddd while tiles load, which flashes pale grey
   against the dark theme. Use a themed surface so loading is unobtrusive. */
.leaflet-container { background: var(--surface-2); }

/* Leaflet chrome follows the page theme. Its defaults are hard-coded white,
   which reads as a bug against the dark basemap. Driven by the same tokens as
   the rest of the site, so it flips automatically with no extra logic. */
.leaflet-popup-content { font-family: var(--sans); font-size: 13.5px; margin: 12px 14px; }
.leaflet-popup-content b { font-family: var(--serif); font-size: 15px; }
.leaflet-popup-content a { color: var(--accent); }
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--surface); color: var(--text);
  box-shadow: 0 3px 14px rgba(0, 0, 0, .25);
}
.leaflet-popup-content-wrapper { border-radius: 10px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-container a.leaflet-popup-close-button:hover { color: var(--text); }

.leaflet-bar a,
.leaflet-bar a:hover {
  background: var(--surface); color: var(--text); border-bottom-color: var(--border);
}
.leaflet-bar a:hover { background: var(--surface-2); }
.leaflet-bar { border: 1px solid var(--border); }

.leaflet-control-attribution {
  background: var(--surface); color: var(--muted); font-size: 10.5px;
}
.leaflet-control-attribution a { color: var(--muted); }

/* admin */
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
label { font-size: 13px; font-weight: 600; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 0; }
legend { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0 6px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.checks label { display: flex; align-items: center; gap: 6px; font-weight: 400; color: var(--text); font-size: 14px; cursor: pointer; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 24px; }
.panel h2 { font-family: var(--serif); margin: 0 0 16px; font-size: 22px; }
.actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; align-items: center; }
.status-msg { font-size: 14px; }
.status-msg.err { color: var(--accent); }
.status-msg.ok { color: var(--good); }
.login { max-width: 380px; margin: 60px auto; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
.row .name { font-weight: 600; }
.row .sub { font-size: 13px; color: var(--muted); }
.row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.row-actions button { padding: 5px 10px; font-size: 13px; }

/* Toolbar — map and filters are both collapsed by default so the list is what
   you land on, which matters most on a phone where the filter row ran six
   controls deep. Both toggles are disclosure controls, deliberately NOT sized
   like the form fields they reveal; matching them made the map toggle read as
   another dropdown. */
.toolbar { display: flex; align-items: center; gap: 8px; margin: 6px 0 20px; flex-wrap: wrap; }
#map[hidden], .controls[hidden] { display: none; }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600; letter-spacing: .01em;
  padding: 5px 13px 5px 11px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  transition: color .15s, border-color .15s;
}
.pill:hover { color: var(--accent); border-color: var(--accent); }
.pill::before {
  content: '';
  width: 0; height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform .15s ease;
}
.pill[aria-expanded="true"]::before { transform: rotate(90deg); }
/* A filter you cannot see is a filter you forget you set, so say so. */
.pill .badge {
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 1;
  padding: 3px 6px; border-radius: 999px; margin-left: 1px;
}
#map-note { font-size: 12.5px; }
