:root {
  --accent: #2196F3;
  --text: #d3d3d3;
  --muted: #a9a9a9;
  --bar: rgba(0, 0, 0, 0.6);
  --mask: rgba(50, 50, 50, 0.7);
  --field: rgba(255, 255, 255, 0.85);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: "Roboto Condensed", sans-serif;
  color: var(--text);
  text-align: center;
  background: #111;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh; /* tracks mobile address bar show/hide */
}
/* Fixed photo layer instead of background-attachment:fixed, which iOS Safari ignores. */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  /* Size to the tallest viewport (address bar hidden) so the photo doesn't
     rescale as mobile browsers show/hide their toolbars while scrolling. */
  height: 100vh;
  height: 100lvh;
  z-index: -1;
  background: center / cover no-repeat;
}
/* The grey mask is part of this fixed layer (not main's background) so it covers the whole
   viewport evenly: the see-through header/footer look the same at the top as mid-scroll. */
body.site-food::before { background-image: linear-gradient(var(--mask), var(--mask)), url("/static/images/food-bg.jpg"); }
body.site-beer::before { background-image: linear-gradient(var(--mask), var(--mask)), url("/static/images/beer-bg.jpg"); }
body.site-www { background-color: #000; }
body.site-www::before { background-image: linear-gradient(var(--mask), var(--mask)); }

h1, h2, h3, h4 { font-family: "Oswald", sans-serif; font-weight: 400; }
h1, h2 { text-transform: uppercase; }

a.normal, a.normal:visited { color: var(--muted); text-decoration: none; }
a.normal:hover { color: #fff; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: var(--bar);
  font-family: "Oswald", sans-serif;
}
.logo img { width: 64px; display: block; }
.account { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.account form { margin: 0; }
/* On phones the header scrolls away instead of covering content. */
@media (max-width: 720px) { .topbar { position: static; } }
.navlink {
  color: #fff;
  text-decoration: none;
  background: none;
  border: 0;
  font: inherit;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
}
.navlink:hover { opacity: 0.8; }
.navlink.signin { background: var(--accent); padding: 8px 14px; border-radius: 4px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; }
.who { color: var(--muted); }
@media (max-width: 520px) { .who { display: none; } }

/* ---------- main ---------- */
.mask {
  flex: 1;
  padding: 24px 16px 48px;
}

.footer {
  background: var(--bar);
  padding: 18px 16px;
  /* Clear the phone's gesture bar / home indicator (env() is 0 where there isn't one). */
  padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  font-size: 16px;
}
.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: #fff; }

img.output { width: 60%; max-width: 240px; display: block; margin: 0 auto; }

/* ---------- landing ---------- */
.editions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  max-width: 1000px;
  margin: 24px auto;
}
.edition { position: relative; display: block; border-radius: 8px; overflow: hidden; }
.edition img { width: 100%; display: block; aspect-ratio: 16 / 10; object-fit: cover; transition: opacity 0.4s; }
.edition span {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-family: "Oswald", sans-serif;
  font-size: 24px;
  padding: 12px 28px;
  white-space: nowrap;
}
.edition:hover img { opacity: 0.4; }

/* ---------- food ---------- */
.status { min-height: 1.5em; }
/* Once location is found the status line is emptied; take no space. The spin button's own
   top margin then puts it in the same spot on food and beer. */
.status:empty { display: none; }
.loader {
  display: block;
  margin: 0 auto;
  border: 12px solid #f3f3f3;
  border-top-color: var(--accent);
  border-radius: 50%;
  width: 96px;
  height: 96px;
  animation: spinner 1.5s linear infinite;
}
@keyframes spinner { to { transform: rotate(360deg); } }

.spin-button { background: none; border: 0; cursor: pointer; padding: 0; margin: 56px auto 8px; display: block; }
.spin-button:hover img, .spin-button:active img { opacity: 0.8; }
.spin-button:focus-visible { outline: 3px solid var(--accent); outline-offset: 6px; border-radius: 50%; }
/* Fast start, long gentle stop into the upright position. */
img.spin { width: 160px; display: block; transition: transform 3s cubic-bezier(0.15, 0.6, 0.15, 1); }

.options {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 420px;
  margin: 16px auto 0;
  padding: 0 16px; /* keep controls off the screen edge on narrow phones */
  font-size: 18px;
}
.select { position: relative; width: 100%; max-width: 260px; }
.select select {
  width: 100%;
  height: 48px;
  padding: 0 44px 0 16px;
  font: inherit;
  font-size: 18px; /* >=16px stops iOS zooming in on focus */
  color: #222;
  background: var(--field);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  appearance: none;
  cursor: pointer;
  transition: background-color 0.15s, box-shadow 0.15s;
}
.select select:hover { background-color: #fff; }
.select select:focus-visible {
  outline: none;
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.6), 0 2px 8px rgba(0, 0, 0, 0.25);
}
.select option { color: #222; background: #fff; }
/* Chevron */
.select::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2px solid #555;
  border-bottom: 2px solid #555;
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* Miles | Kilometers toggle: one unit, never wraps */
.segmented {
  display: flex;
  flex-wrap: nowrap;
  white-space: nowrap;
  width: 100%;
  max-width: 260px; /* same width as the distance dropdown */
  padding: 3px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 10px;
}
.segmented label { position: relative; flex: 1; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: block;
  padding: 8px 12px;
  border-radius: 7px;
  color: var(--text);
  transition: background-color 0.15s, color 0.15s;
}
.segmented label:hover span { color: #fff; }
.segmented input:checked + span { background: var(--accent); color: #fff; }
.segmented input:focus-visible + span { outline: 2px solid #fff; outline-offset: -2px; }


.result { max-width: 1000px; margin: 0 auto 16px; scroll-margin-top: 96px; /* clear the sticky header on desktop */ }
.result .map {
  width: 100%;
  height: 260px;
  border: 3px solid #505050;
  border-radius: 10px;
  display: block;
}
.result h3 { font-size: 26px; margin: 16px 0 4px; }
.result .eat { color: var(--muted); }
.result .address { margin: 0; }
.result .meta { color: var(--muted); }

.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 12px 0; }
.btn {
  display: inline-block;
  padding: 10px 18px;
  border: 0;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font: inherit;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: rgba(255, 255, 255, 0.28); color: #fff; }
.btn.directions { background: var(--accent); }
.btn.love.active { background: #e0a800; color: #000; }
.btn.never.active { background: #c62828; }
.btn.small { padding: 6px 12px; font-size: 14px; }

/* ---------- favorites ---------- */
/* Each list is a card with a see-through header box like the site header/footer. */
.marks {
  max-width: 700px;
  margin: 0 auto 24px;
  text-align: left;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  overflow: hidden;
}
.marks-head {
  padding: 12px 16px 10px;
  background: var(--bar);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}
.marks h3 {
  margin: 0;
  color: #fff;
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.marks.favorite h3::before { content: "\2605  "; color: #e0a800; }
.marks.blocked h3::before { content: "\2717  "; color: #e57373; }
.marks .hint { color: var(--muted); margin: 2px 0 0; font-size: 14px; }
.marks ul { list-style: none; padding: 0 16px 4px; margin: 0; }
.marks li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
.marks li:last-child { border-bottom: 0; }
.mark-name { font-weight: 700; color: #fff; }
.mark-addr { grid-column: 1; color: var(--muted); font-size: 14px; }
.marks .js-remove { grid-column: 2; grid-row: 1 / span 2; align-self: center; }

/* ---------- beer ---------- */
.beer-photo {
  display: block;
  margin: 0 auto;
  max-width: 220px;
  max-height: 280px;
  width: auto;
  height: auto;
  border-radius: 10px;
  background: var(--bar); /* same see-through black as the header/footer */
  padding: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
.result .brand { margin: 0; color: #fff; }
.credit { margin-top: 28px; font-size: 13px; color: var(--muted); }
/* Credited source names. Google's attribution rules for "Google Maps": exact text, Roboto 400,
   white (or #1F1F1F/#5E5E5E), 12-16px; the others match it. */
.credit-name { font-family: "Roboto", sans-serif; font-weight: 400; color: #fff; }
a.credit-name { text-decoration: none; }
a.credit-name:hover { text-decoration: underline; }
.country-line { margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.widened-note { margin: 4px auto 0; max-width: 420px; font-size: 14px; color: var(--muted); font-style: italic; }
