/* MAVARA Directory. Neutral placeholder palette until the brand assets (#3) arrive.
   Built for small, low-end phones: system fonts, no images, 48px tap targets, works at 320px. */

:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --fg: #1d1b1a;
  --muted: #5f5a56;
  --line: #e4e0db;
  --accent: #7a2e5a;
  --accent-fg: #ffffff;
  --accent-soft: #f4e8ef;
  --warn-bg: #fff4d6;
  --warn-fg: #6b4a00;
  --ok: #1f6b45;
  --ok-soft: #e3f3ea;
  --radius: 12px;
  --tap: 48px;
  --tabs: 60px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141213;
    --surface: #1e1b1d;
    --fg: #f1edef;
    --muted: #b3aaae;
    --line: #342f32;
    --accent: #e39bc4;
    --accent-fg: #2a0f1f;
    --accent-soft: #3a2230;
    --warn-bg: #3b3013;
    --warn-fg: #ffd98a;
    --ok: #8fd8b0;
    --ok-soft: #173426;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  /* Room at the bottom for the tab bar (and the phone's own gesture area). */
  padding: 0 16px calc(var(--tabs) + 32px + env(safe-area-inset-bottom, 0px));
}

a {
  color: var(--accent);
}

h1 {
  font-size: 1.4rem;
  line-height: 1.25;
  margin: 4px 0 8px;
  overflow-wrap: break-word;
  hyphens: auto;
}

h2 {
  font-size: 1rem;
  margin: 1.25rem 0 0.5rem;
}

/* Top bar: back (or brand) and nav on one row, the page title full width below */
.top {
  padding: 8px 0 0;
}

.top .bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 8px;
  margin: 0 -6px;
}

.brand {
  white-space: nowrap;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--fg);
  text-decoration: none;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
}

.back {
  min-height: var(--tap);
  min-width: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  text-decoration: none;
  border-radius: var(--radius);
}

.back {
  font-size: 2rem;
  line-height: 1;
}

.back:focus-visible {
  outline: 3px solid var(--accent);
}

.tagline {
  color: var(--muted);
  margin: 0 0 8px;
}

/* Status: freshness, offline, notices */
.status p {
  margin: 4px 0;
}

.fresh {
  color: var(--muted);
  font-size: 0.9rem;
}

.warn,
.fresh.warn {
  background: var(--warn-bg);
  color: var(--warn-fg);
  padding: 8px 12px;
  border-radius: var(--radius);
}

.pill {
  display: inline-block;
  font-size: 0.8rem;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.notice {
  background: var(--ok-soft);
  color: var(--ok);
  padding: 8px 12px;
  border-radius: var(--radius);
}

.update {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--accent);
  color: var(--accent-fg);
  padding: 8px 12px;
  margin: 0 -16px;
}

/* Controls */
button,
.button,
select,
input[type="search"] {
  min-height: var(--tap);
  font: inherit;
  border-radius: var(--radius);
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 16px;
  border: 0;
  background: var(--accent);
  color: var(--accent-fg);
  text-decoration: none;
  cursor: pointer;
}

button.secondary,
.button.secondary {
  background: var(--accent-soft);
  color: var(--fg);
}

/* A button that reads as a link, for a secondary choice inside a sentence. */
button.link {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
}

button.wide {
  width: 100%;
  margin: 8px 0;
}

select,
input[type="search"] {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  padding: 0 12px;
  max-width: 100%;
}

.search {
  display: flex;
  gap: 8px;
  margin: 12px 0 0;
}

.search input {
  flex: 1;
  min-width: 0;
}

/* Needs */
.needs {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.chip {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--fg);
  text-decoration: none;
}

.wide-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
}

/* List */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
}

/* One row of filters, swiped sideways when it doesn't fit, so results stay near the top. */
.filters.swipe {
  flex-wrap: nowrap;
  overflow-x: auto;
  /* Let the row run to the screen edges, so a cut-off chip shows there is more. */
  margin-left: -16px;
  margin-right: -16px;
  padding: 2px 16px;
  scrollbar-width: none;
}

.filters.swipe::-webkit-scrollbar {
  display: none;
}

.filters.swipe .fchip {
  flex: none;
}

/* A filter you can tap: off, or on (filled). */
.fchip {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 4px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  text-decoration: none;
  font-size: 0.95rem;
}

.fchip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.fchip:focus-visible,
.suggestion:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}

/* Choosing an area */
.picker {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.picker input {
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
}

.areas {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 40vh;
  overflow-y: auto;
}

/* Suggestions under the search box */
.suggest {
  margin: 0 0 8px;
}

.suggestion {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  column-gap: 12px;
  min-height: var(--tap);
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
  color: var(--fg);
  text-decoration: none;
}

.suggestion.all {
  color: var(--accent);
  border-bottom: 0;
}

.badge.hours-open {
  background: var(--ok-soft);
  color: var(--ok);
}

.check {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  gap: 6px;
}

.check input {
  width: 22px;
  height: 22px;
}

.meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.note {
  background: var(--accent-soft);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 0.95rem;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 24px 0;
}

.results {
  list-style: none;
  padding: 0;
  margin: 0;
}

.results li + li {
  border-top: 1px solid var(--line);
}

.results a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 4px;
  min-height: var(--tap);
  color: var(--fg);
  text-decoration: none;
}

.results .sub,
.provider .sub {
  color: var(--muted);
  font-size: 0.9rem;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.dist {
  color: var(--muted);
  font-size: 0.9rem;
}

.badge {
  font-size: 0.8rem;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--line);
  color: var(--muted);
}

.badge.v-desk_checked,
.badge.v-facility_verified,
.badge.v-field_verified,
.badge.v-published {
  background: var(--ok-soft);
  color: var(--ok);
}

/* Provider */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.actions .button {
  flex: 1 1 120px;
}

.verify .help {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 4px 0;
}

.services {
  padding-left: 1.2rem;
}

.status.s-reported,
.status.s-confirmed {
  font-size: 0.8rem;
  color: var(--muted);
}

.status.s-confirmed {
  color: var(--ok);
}

.field p {
  margin: 0;
  overflow-wrap: anywhere;
}

.attribution {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 24px;
}

.prose .disclaimer {
  font-weight: 600;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* Correction form */
.correction .field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 10px 0;
}

.correction input:not([type="checkbox"]),
.correction textarea {
  min-height: var(--tap);
  font: inherit;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg);
  width: 100%;
}

.correction .svc {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.correction .svc select {
  flex: 0 0 9.5rem;
}

.correction summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  font-weight: 600;
  cursor: pointer;
}

/* Honeypot: off-screen, never shown to people. */
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Animated QR bump */
canvas.qr {
  display: block;
  margin: 12px auto;
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
  background: #fff;
  border-radius: 8px;
}

video.camera {
  display: block;
  width: 100%;
  max-height: 60vh;
  object-fit: cover;
  border-radius: var(--radius);
  background: #000;
}

progress {
  width: 100%;
  height: 12px;
  margin-top: 12px;
  accent-color: var(--accent);
}

.button.wide {
  width: 100%;
}

/* Map */
.map {
  height: 65vh;
  min-height: 320px;
  border-radius: var(--radius);
  overflow: hidden;
  margin: 8px 0;
  background: var(--line);
}

/* The small map on a provider's page. */
.map.mini {
  height: 200px;
  min-height: 0;
  margin: 8px 0 12px;
}

.map .popup a {
  color: var(--accent);
}

.note progress {
  display: block;
  margin-top: 8px;
}

/* Language switch on the home screen */
.langs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 8px;
}

button.lang {
  min-height: 36px;
  padding: 0 12px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.9rem;
}

button.lang.current {
  background: var(--accent-soft);
  color: var(--fg);
  border-color: var(--accent-soft);
}

/* Tab bar: the app's main places, fixed at the bottom of every screen */
.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  /* Above the map, whose layers use z-indexes up to 1000. */
  z-index: 1100;
  display: flex;
  justify-content: center;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg);
  border-top: 1px solid var(--line);
}

.tab {
  flex: 1 1 0;
  max-width: 128px;
  min-width: 0;
  height: var(--tabs);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.2;
  text-decoration: none;
}

.tab .label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab[aria-current="page"] {
  color: var(--accent);
  font-weight: 700;
}

.tab:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

/* Icons are drawn as masks, so they take the text colour. */
.tab .icon {
  width: 24px;
  height: 24px;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.tab-home .icon {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 11.5 12 4l8 7.5V20h-5.5v-5.5h-5V20H4z'/%3E%3C/svg%3E");
}

.tab-list .icon {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 6h2v2H4zM9 6h11v2H9zM4 11h2v2H4zM9 11h11v2H9zM4 16h2v2H4zM9 16h11v2H9z'/%3E%3C/svg%3E");
}

.tab-map .icon {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 2.5a6.5 6.5 0 0 0-6.5 6.5c0 4.6 6.5 12.5 6.5 12.5s6.5-7.9 6.5-12.5A6.5 6.5 0 0 0 12 2.5zm0 9a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5z'/%3E%3C/svg%3E");
}

.tab-bump .icon {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 4 3 8l4 4V9h9V7H7zM17 12v3H8v2h9v3l4-4z'/%3E%3C/svg%3E");
}

.tab-more .icon {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 10.25a1.75 1.75 0 1 0 0 3.5 1.75 1.75 0 0 0 0-3.5zm7 0a1.75 1.75 0 1 0 0 3.5 1.75 1.75 0 0 0 0-3.5zm7 0a1.75 1.75 0 1 0 0 3.5 1.75 1.75 0 0 0 0-3.5z'/%3E%3C/svg%3E");
}
