/* ============================================================
   NOM NOM QUEST — styles
   Cheerful, game-like restaurant selector.
   High-contrast palette tuned for daylight readability.
   ============================================================ */

/* ============ DESIGN TOKENS ============ */
:root {
  --bg: #FFF4DA;          /* warm cream */
  --bg-2: #FFE2A8;        /* buttery yellow */
  --ink: #231A1A;         /* near-black, warm */
  --tomato: #E8442C;      /* hot tomato red */
  --tomato-dark: #B3301E;
  --basil: #1F7A4C;       /* deep basil green */
  --basil-dark: #14583A;
  --mustard: #F2B705;     /* mustard accent */
  --plum: #6B2D5C;        /* deep plum for contrast */
  --sky: #2E6FD6;         /* saturated blue */
  --paper: #FFFBF0;       /* card paper */
  --shadow: 6px 6px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --shadow-lg: 10px 10px 0 var(--ink);
  --radius: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 12% 18%, rgba(232,68,44,0.10) 0, transparent 28%),
    radial-gradient(circle at 88% 82%, rgba(31,122,76,0.12) 0, transparent 32%),
    radial-gradient(circle at 70% 10%, rgba(242,183,5,0.18) 0, transparent 26%);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* subtle checker grid in the background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--ink) 1px, transparent 1px),
    linear-gradient(90deg, var(--ink) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.04;
  pointer-events: none;
  z-index: 0;
}

/* ============ LAYOUT ============ */
.wrap {
  position: relative;
  z-index: 1;
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

/* ============ HEADER ============ */
header {
  text-align: center;
  padding: 18px 8px 28px;
  position: relative;
}

.badge {
  display: inline-block;
  font-family: 'Fraunces', serif;
  font-weight: 900;
  letter-spacing: 0.02em;
  background: var(--ink);
  color: var(--bg-2);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  text-transform: uppercase;
  transform: rotate(-2deg);
  box-shadow: var(--shadow-sm);
}

h1 {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: clamp(2.4rem, 8vw, 4.6rem);
  line-height: 0.95;
  margin-top: 14px;
  letter-spacing: -0.02em;
}

h1 .accent-red { color: var(--tomato); display: inline-block; transform: rotate(-3deg); }
h1 .accent-green { color: var(--basil); font-style: italic; }

.tagline {
  margin-top: 14px;
  font-size: clamp(0.95rem, 2.2vw, 1.1rem);
  color: var(--ink);
  opacity: 0.75;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

/* ============ ZIP CARD ============ */
.zip-card {
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin: 28px auto 30px;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}

.zip-card::before {
  content: "📍";
  position: absolute;
  top: -18px;
  left: 22px;
  background: var(--mustard);
  border: 3px solid var(--ink);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  box-shadow: var(--shadow-sm);
}

.zip-card label {
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-left: 60px;
}

.zip-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.zip-input {
  flex: 1 1 180px;
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 1.5rem;
  padding: 12px 16px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0.15em;
  outline: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.zip-input::placeholder { color: rgba(35,26,26,0.35); letter-spacing: 0.15em; }
.zip-input:focus { transform: translate(-2px,-2px); box-shadow: var(--shadow-sm); background: #fff; }

/* ============ MAP PREF ============ */
.map-pref-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 60px;
  font-size: 0.8rem;
}

.map-pref-row label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
}

.map-pref-select {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 6px 10px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.map-pref-select:focus {
  outline: none;
  background: #fff;
}

@media (max-width: 640px) {
  .map-pref-row { margin-left: 0; flex-wrap: wrap; }
}

/* ============ BUTTONS ============ */
.btn {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  padding: 14px 22px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: var(--tomato);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.btn:hover { transform: translate(-2px,-2px); box-shadow: 5px 5px 0 var(--ink); }
.btn:active { transform: translate(1px,1px); box-shadow: 2px 2px 0 var(--ink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: var(--shadow-sm); }

.btn-big {
  font-family: 'Fraunces', serif;
  font-size: 1.35rem;
  font-weight: 900;
  padding: 18px 28px;
  background: var(--basil);
  width: 100%;
  max-width: 560px;
  display: block;
  margin: 10px auto 0;
  box-shadow: var(--shadow);
}
.btn-big:hover { box-shadow: var(--shadow-lg); }

.btn-ghost {
  background: var(--paper);
  color: var(--ink);
}

/* ============ GRID ============ */
.grid-title {
  text-align: center;
  margin: 36px 0 18px;
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: clamp(1.3rem, 3.5vw, 1.8rem);
}

.grid-title span {
  background: var(--mustard);
  padding: 2px 10px;
  border-radius: 6px;
  border: 2px solid var(--ink);
  display: inline-block;
  transform: rotate(-1deg);
}

.food-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 10px;
}

.food-card {
  aspect-ratio: 1 / 1;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  user-select: none;
}

.food-card:hover { transform: translate(-3px,-3px) rotate(-1deg); box-shadow: var(--shadow); }
.food-card:active { transform: translate(0,0); box-shadow: var(--shadow-sm); }

.food-card.selected {
  background: var(--mustard);
  transform: translate(-3px,-3px) rotate(-2deg);
  box-shadow: var(--shadow);
}

.food-card.selected::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--basil);
  color: #fff;
  font-weight: 900;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  display: grid;
  place-items: center;
  font-size: 0.9rem;
}

.food-card.disabled {
  opacity: 0.35;
  pointer-events: none;
}

.food-emoji {
  font-size: clamp(2.2rem, 7vw, 3.2rem);
  line-height: 1;
  filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.15));
  margin-bottom: 4px;
}

.food-label {
  font-weight: 700;
  font-size: clamp(0.7rem, 1.9vw, 0.9rem);
  letter-spacing: 0.01em;
}

.food-count {
  font-family: 'Fraunces', serif;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--ink);
  color: var(--bg);
  padding: 2px 6px;
  border-radius: 6px;
  margin-top: 4px;
}

/* color-coded card backgrounds for the starting grid */
.food-card[data-idx="0"] { background: #FFD4CC; }
.food-card[data-idx="1"] { background: #D4ECDC; }
.food-card[data-idx="2"] { background: #FFE7B3; }
.food-card[data-idx="3"] { background: #D6E4F7; }
.food-card[data-idx="4"] { background: #F2D4E2; }
.food-card[data-idx="5"] { background: #FFE0B8; }
.food-card[data-idx="6"] { background: #D8F0E0; }
.food-card[data-idx="7"] { background: #FFD9C6; }
.food-card[data-idx="8"] { background: #E8DDF5; }

.more-cuisines-btn {
  display: block;
  margin: 14px auto 0;
  padding: 8px 16px;
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: 0.01em;
}

/* ============ STATUS BAR ============ */
.status {
  text-align: center;
  margin: 20px auto 6px;
  font-weight: 500;
  min-height: 1.4em;
  color: var(--ink);
}

.status strong { color: var(--tomato); }

/* ============ LOADER ============ */
.loader-wrap { text-align: center; padding: 24px; }
.loader {
  display: inline-flex;
  gap: 8px;
  font-size: 2rem;
  line-height: 1;
}
.loader span {
  animation: bounce 0.9s infinite;
  display: inline-block;
}
.loader span:nth-child(2) { animation-delay: 0.15s; }
.loader span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

/* ============ RESULTS ============ */
.results {
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-top: 28px;
}

.results h2 {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 1.6rem;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.results h2 .pill {
  background: var(--tomato);
  color: #fff;
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 2px solid var(--ink);
}

.restaurant-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.restaurant {
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.12s ease;
}

.restaurant:hover { transform: translateX(4px); background: var(--bg-2); }

.restaurant .name {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 1.1rem;
}

.restaurant .meta {
  font-size: 0.85rem;
  opacity: 0.75;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.restaurant .meta .rating { color: var(--tomato-dark); font-weight: 700; }

.back-btn {
  margin-top: 18px;
  background: var(--ink);
  color: var(--bg-2);
}

/* ============ ERROR ============ */
.error {
  background: var(--tomato);
  color: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
  margin: 16px auto;
  max-width: 560px;
  text-align: center;
  font-weight: 500;
}

.hidden { display: none !important; }

/* ============ DECORATIVE SQUIGGLES ============ */
.squiggle {
  position: absolute;
  pointer-events: none;
  z-index: 0;
}
.squiggle.one { top: 70px; left: -30px; transform: rotate(-18deg); opacity: 0.5; }
.squiggle.two { top: 30px; right: -20px; transform: rotate(22deg); opacity: 0.5; }

/* ============ MOBILE ============ */
@media (max-width: 640px) {
  .wrap { padding: 18px 14px 60px; }
  .zip-card { padding: 18px; }
  .zip-card::before { left: 14px; top: -16px; width: 38px; height: 38px; }
  .zip-card label { margin-left: 50px; }
  .food-grid { gap: 10px; }
  .food-card { border-width: 2.5px; }
  .btn { font-size: 0.9rem; padding: 12px 16px; }
  .squiggle { display: none; }
}

@media (max-width: 380px) {
  .food-grid { gap: 8px; }
  .food-label { font-size: 0.68rem; }
}

/* reduce motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
