:root {
  --bg: #FFF8E7;
  --surface: #ffffff;
  --surface-border: rgba(139, 69, 19, 0.18);
  --text: #3A2415;
  --text-muted: rgba(58, 36, 21, 0.62);
  --heading: #8B4513;
  --accent: #FFBF00;
  --accent-contrast: #3A2415;
  --accent-secondary: #D94F30;
  --olive: #7A8B4A;
  --success: #5C6B39;
  --error: #C0392B;
  --link: #B54418;
}

/* Cookie banner theme: reuse the site palette instead of Silktide's defaults.
   Selector is doubled (#silktide-wrapper#silktide-wrapper) to outrank the
   equal-specificity #silktide-wrapper rule in css/silktide-consent-manager.css,
   which is linked after this stylesheet in index.html/submit.html and would
   otherwise win the cascade and silently no-op this override. */
#silktide-wrapper#silktide-wrapper {
  --primaryColor: var(--accent);
  --backgroundColor: var(--heading);
  --textColor: var(--bg);
  --cookieIconColor: var(--accent);
  --cookieIconBackgroundColor: var(--heading);
}

.legal-links,
.legal-footer {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.legal-links a,
.legal-footer a,
.legal-links button,
.legal-footer button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--link);
  text-decoration: none;
  cursor: pointer;
}

.legal-links a:hover,
.legal-footer a:hover,
.legal-links button:hover,
.legal-footer button:hover {
  text-decoration: underline;
}

/* submit.html has no desktop sidebar (unlike index.html's .legal-links
   block), so its .legal-footer — normally .mobile-only — needs to stay
   visible at all widths; this is the only page that collects personal
   data (optional email field), so it must always link to the privacy
   policy. Scoped to .form-page so index.html's .legal-footer is unaffected
   and remains governed by .mobile-only's media-query behavior. */
.form-page .legal-footer {
  display: flex;
  flex: 0 0 auto;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  margin-top: 1.5rem;
  border-top: 1px solid var(--surface-border);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.topbar {
  flex: 0 0 auto;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.9rem;
  background: var(--surface);
  border-bottom: 1px solid var(--surface-border);
}

.topbar h1 {
  font-size: 1.05rem;
  margin: 0;
  font-weight: 700;
  color: var(--heading);
}

.topbar-sub {
  font-weight: 400;
  opacity: 0.65;
  font-size: 0.85rem;
  margin-left: 0.35rem;
}

.submit-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid rgba(255, 191, 0, 0.5);
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lang-toggle-btn {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--heading);
}

/* Layout: mobile-first — filters on top, map fills the rest below. */
.layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.controls {
  flex: 0 0 auto;
  z-index: 5;
  background: var(--surface);
  border-bottom: 1px solid var(--surface-border);
  padding: 0.6rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.map-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

#map {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  justify-content: space-between;
}

.control-row label {
  font-size: 0.85rem;
  flex: 1;
}

#max-price {
  flex: 1;
  max-width: 55%;
  accent-color: var(--accent);
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.switch-label input {
  accent-color: var(--accent);
}

.dietary-row {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
}

.dietary-row-label {
  font-size: 0.85rem;
}

.dietary-chips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.dietary-chip {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
}

.dietary-chip.active {
  background: var(--olive);
  border-color: var(--olive);
  color: #FFF8E7;
}

.hidden {
  display: none !important;
}

/* Honeypot: kept in normal layout flow (not display:none) so bots that
   skip hidden fields still fill it in, but invisible and unreachable
   for real users/keyboard nav. */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.mobile-only {
  display: none;
}

.filters-toggle-btn {
  position: relative;
  align-items: center;
  gap: 0.3rem;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--heading);
}

.filters-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-secondary);
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 6;
  background: rgba(58, 36, 21, 0.35);
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--surface-border);
  border-radius: 2px;
  margin: 0 auto 0.6rem;
}

.show-results-btn {
  background: var(--heading);
  color: var(--bg);
  border: none;
  border-radius: 12px;
  padding: 0.8rem;
  font-weight: 700;
  font-size: 1rem;
  margin-top: 0.5rem;
}

.popup-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.sheet-close-btn {
  position: absolute;
  top: 0.7rem;
  right: 0.8rem;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 15px;
  line-height: 26px;
  padding: 0;
  font-weight: 800;
  cursor: pointer;
}

.popup-status-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.4rem 0;
}

.popup-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.popup-status-dot.open {
  background: var(--success);
}

.popup-status-dot.closed {
  background: #C9BFB2;
}

.popup-status-text {
  font-size: 0.85rem;
  font-weight: 700;
}

.popup-status-text.open {
  color: var(--success);
}

.popup-status-text.closed {
  color: #9A8C7B;
}

.popup-dietary-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 0.4rem 0;
}

.popup-dietary-tags .dietary-tag {
  background: #EAF0DD;
  color: var(--success);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid #D4E0C0;
}

.detail-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 7;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 0.6rem 1.1rem 1.5rem;
  box-shadow: 0 -8px 24px rgba(58, 36, 21, 0.25);
  max-height: 78vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.25s ease;
}

.detail-sheet.sheet-open {
  transform: translateY(0);
}

@media (max-width: 768px) {
  .mobile-only {
    display: flex;
  }

  .legal-links {
    display: none;
  }

  .controls {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 7;
    max-height: 78vh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 24px rgba(58, 36, 21, 0.25);
    transform: translateY(100%);
    transition: transform 0.25s ease;
  }

  .controls.sheet-open {
    transform: translateY(0);
  }

  .legal-footer {
    flex: 0 0 auto;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    background: var(--surface);
    border-top: 1px solid var(--surface-border);
  }
}

/* Desktop: filters become a right-hand sidebar instead of a top bar. */
@media (min-width: 769px) {
  .layout {
    flex-direction: row;
  }

  .map-card {
    order: 1;
  }

  .controls {
    order: 2;
    flex: 0 0 400px;
    border-bottom: none;
    border-left: 1px solid var(--surface-border);
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding: 1.75rem;
    background: #fdf9ef;
  }

  .control-row,
  .dietary-row {
    background: #fff;
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    padding: 1.1rem 1.2rem;
  }

  .control-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }

  .control-row label,
  .dietary-row-label {
    font-size: 1rem;
  }

  .switch-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
  }

  .dietary-chip {
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
  }

  #max-price {
    max-width: 100%;
    height: 6px;
  }

  #max-price::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--surface);
    box-shadow: 0 0 0 1px var(--surface-border);
    cursor: pointer;
  }

  #max-price::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--surface);
    box-shadow: 0 0 0 1px var(--surface-border);
    cursor: pointer;
  }

  .results-count {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px dashed var(--surface-border);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
  }

  .legal-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding-top: 0.75rem;
  }

}

/* Popup */
.maplibregl-popup-content {
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  box-shadow: 0 2px 10px rgba(58, 36, 21, 0.2), 0 0 0 1px var(--surface-border);
}

.maplibregl-popup-tip {
  border-top-color: var(--surface) !important;
  border-bottom-color: var(--surface) !important;
}

.popup-name {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.popup-price {
  display: inline-block;
  margin: 0 0 0.2rem;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--heading);
  background: rgba(255, 191, 0, 0.28);
  padding: 0.2rem 0.55rem;
  border-radius: 7px;
}

.popup-description,
.popup-meta {
  margin: 0.15rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.popup-links {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.popup-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  text-decoration: none;
  color: var(--link);
}

.popup-link svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.popup-link-facebook {
  color: #1877f2;
}

.popup-link-instagram {
  color: #e1306c;
}

/* On the mobile bottom sheet, links are the primary tap targets — render
   them as large, evenly-split pill buttons instead of small inline text. */
.detail-sheet .popup-links {
  gap: 0.6rem;
}

.detail-sheet .popup-link {
  flex: 1 1 0;
  justify-content: center;
  min-height: 44px;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  background: var(--bg);
  font-size: 0.85rem;
  font-weight: 700;
}

/* Submission form page: the map page's body is locked (fixed height,
   no scroll) since the map fills the viewport itself; the form page has
   no such fill-element, so it needs the body to scroll normally. */
body.form-page-body {
  height: auto;
  overflow: visible;
}

.form-page {
  max-width: 560px;
  margin: 0 auto;
  padding: 1.2rem 1rem 3rem;
}

.form-page h1 {
  font-size: 1.3rem;
}

.form-page-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.form-page a.back-link {
  color: var(--accent);
  font-size: 0.85rem;
  text-decoration: none;
}

form.lunch-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin-top: 1rem;
}

.form-section {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  padding: 1.1rem 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.form-section-title {
  margin: 0;
  font-size: 1rem;
  color: var(--heading);
}

.form-section-hint {
  margin: -0.6rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* The optional email nudge stays visually quiet and collapsed by
   default — this is deliberately the lowest-priority ask on the form. */
.form-section-quiet {
  background: transparent;
  border: 1px dashed var(--surface-border);
  padding: 0.7rem 1.1rem;
  gap: 0;
}

.form-section-quiet[open] {
  padding-bottom: 1rem;
}

.form-section-quiet summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  list-style: none;
}

.form-section-quiet summary::-webkit-details-marker {
  display: none;
}

.form-section-quiet summary::before {
  content: "+ ";
  color: var(--accent-secondary);
  font-weight: 700;
}

.form-section-quiet[open] summary::before {
  content: "− ";
}

.form-section-quiet[open] summary {
  margin-bottom: 0.7rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field label {
  font-size: 0.85rem;
  font-weight: 600;
}

.hint {
  font-size: 0.75rem;
  opacity: 0.6;
  font-weight: 400;
}

.field input,
.field textarea {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 0.55rem 0.6rem;
  color: var(--text);
  font-size: 0.95rem;
}

.field input:focus,
.field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.field textarea {
  min-height: 4.5rem;
  resize: vertical;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 400;
}

.days-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

#days-error {
  color: var(--error);
  font-size: 0.8rem;
  margin: 0.3rem 0 0;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.submit-btn {
  background: var(--accent);
  color: var(--accent-contrast);
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-weight: 700;
  font-size: 1rem;
  margin-top: 0.5rem;
}

.submit-btn:disabled {
  opacity: 0.6;
}

#form-status {
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

#form-status:empty {
  display: none;
}

#form-status.success,
#form-status.error {
  font-weight: 700;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
}

#form-status.success {
  color: var(--success);
  background: #EAF0DD;
}

#form-status.error {
  color: var(--error);
  background: rgba(192, 57, 43, 0.1);
}

.geocode-btn {
  align-self: flex-start;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

.geocode-btn:disabled {
  opacity: 0.6;
}

/* Confirmation — styled like a lunch order ticket: a stamped check,
   a torn/perforated divider, then a receipt-style recap of what was
   submitted. This is the one moment on the form worth a flourish. */
.confirmation {
  background: var(--surface);
  border-radius: 16px;
  padding: 2rem 1.5rem 1.75rem;
  margin-top: 1rem;
  box-shadow: 0 14px 34px rgba(74, 47, 28, 0.14);
  text-align: center;
}

.confirmation-stamp {
  width: 48px;
  height: 48px;
  margin: 0 auto 0.9rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirmation-title {
  margin: 0 0 0.35rem;
  color: var(--heading);
  font-size: 1.25rem;
}

.confirmation-lede {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.ticket-divider {
  position: relative;
  height: 1px;
  margin: 1.4rem -1.5rem;
  border-top: 2px dashed var(--surface-border);
}

.ticket-divider::before,
.ticket-divider::after {
  content: "";
  position: absolute;
  top: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg);
}

.ticket-divider::before {
  left: -10px;
}

.ticket-divider::after {
  right: -10px;
}

.confirmation-recap {
  margin: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.confirmation-recap .recap-row {
  display: flex;
  gap: 0.9rem;
  justify-content: space-between;
  border-bottom: 1px dashed var(--surface-border);
  padding-bottom: 0.7rem;
}

.confirmation-recap .recap-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.confirmation-recap dt {
  flex: 0 0 auto;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  padding-top: 0.15rem;
}

.confirmation-recap dd {
  margin: 0;
  flex: 1 1 auto;
  text-align: right;
  font-size: 0.9rem;
  color: var(--text);
}

.confirmation-recap dd a {
  color: var(--link);
}

.confirmation-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.6rem;
}

.confirmation-btn {
  flex: 1 1 0;
  text-align: center;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
}

.confirmation-btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.confirmation-btn-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--surface-border);
}

@media (max-width: 480px) {
  .confirmation-actions {
    flex-direction: column;
  }

  .confirmation-recap .recap-row {
    flex-direction: column;
    gap: 0.2rem;
  }

  .confirmation-recap dd {
    text-align: left;
  }
}

#geocode-status.error {
  color: var(--error);
}

#geocode-status.success {
  color: var(--success);
}

@media (max-width: 480px) {
  .two-col {
    grid-template-columns: 1fr;
  }
  .topbar h1 {
    font-size: 0.95rem;
  }
}
