/* ============================================================
   Foodmapme — Base + Components
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-weight: var(--fw-regular);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .35s var(--ease), color .35s var(--ease);
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }
::selection { background: var(--brand-soft); color: var(--brand-strong); }

h1, h2, h3 { line-height: var(--lh-tight); font-weight: var(--fw-bold); letter-spacing: -0.02em; text-wrap: balance; }
p { text-wrap: pretty; }

.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1.1rem, 4vw, 2.5rem); }
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  letter-spacing: .12em; text-transform: uppercase; color: var(--brand-strong);
}
.muted { color: var(--ink-3); }
.section { padding-block: clamp(3.5rem, 8vw, 6.5rem); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  --_bg: var(--surface); --_fg: var(--ink); --_bd: var(--border);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 0.7em 1.25em; border-radius: var(--r-pill);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); letter-spacing: .005em;
  background: var(--_bg); color: var(--_fg);
  border: 1px solid var(--_bd); cursor: pointer; white-space: nowrap;
  transition: transform .12s var(--ease), box-shadow .2s var(--ease),
              background .2s var(--ease), border-color .2s var(--ease), filter .2s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.985); }
.btn svg { width: 1.15em; height: 1.15em; }

.btn--primary { --_bg: var(--brand); --_fg: var(--on-brand); --_bd: transparent; box-shadow: 0 6px 18px -6px color-mix(in oklab, var(--brand) 75%, transparent); }
.btn--primary:hover { --_bg: var(--brand-strong); box-shadow: 0 10px 26px -8px color-mix(in oklab, var(--brand) 80%, transparent); }
.btn--ghost { --_bg: transparent; --_bd: transparent; }
.btn--ghost:hover { --_bg: var(--surface-2); }
.btn--outline { --_bg: transparent; }
.btn--outline:hover { --_bd: var(--brand); --_fg: var(--brand-strong); }
.btn--soft { --_bg: var(--brand-soft); --_fg: var(--brand-strong); --_bd: transparent; }
.btn--soft:hover { filter: brightness(.97); }
.btn--danger { --_bg: var(--danger); --_fg: var(--on-danger); --_bd: transparent; }
.btn--danger:hover { filter: brightness(.94); }
.btn--lg { padding: 0.85em 1.6em; font-size: var(--fs-base); }
.btn--sm { padding: 0.5em 0.9em; font-size: var(--fs-xs); }
.btn--icon { padding: 0.6em; aspect-ratio: 1; border-radius: var(--r-pill); }
.btn--block { width: 100%; }

/* ============================================================
   BADGES / CHIPS / TAGS
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 0.4em;
  padding: 0.32em 0.72em; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); line-height: 1;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border);
}
.badge--brand { background: var(--brand-soft); color: var(--brand-strong); border-color: transparent; }
.badge--success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge--danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge--solid { background: var(--brand); color: var(--on-brand); border-color: transparent; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.chip {
  display: inline-flex; align-items: center; gap: 0.45em;
  padding: 0.5em 0.95em; border-radius: var(--r-pill);
  font-size: var(--fs-sm); font-weight: var(--fw-medium);
  background: var(--surface); color: var(--ink-2);
  border: 1px solid var(--border); cursor: pointer; white-space: nowrap;
  transition: all .18s var(--ease);
}
.chip:hover { border-color: var(--border-strong); color: var(--ink); }
.chip[aria-pressed="true"], .chip.is-active {
  background: var(--brand); color: var(--on-brand); border-color: transparent;
  box-shadow: 0 5px 14px -6px color-mix(in oklab, var(--brand) 80%, transparent);
}
.chip svg { width: 1.05em; height: 1.05em; }

/* star rating */
.stars { display: inline-flex; align-items: center; gap: 0.28em; font-weight: var(--fw-semibold); font-size: var(--fs-sm); }
.stars svg { width: 1em; height: 1em; color: var(--star); }

/* ============================================================
   FORM FIELDS
   ============================================================ */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field > label { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--ink-2); }
.field .hint { font-size: var(--fs-xs); color: var(--ink-3); }
.input, .textarea, .select {
  width: 100%; padding: 0.72em 0.95em;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: var(--r-md);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.textarea { min-height: 96px; resize: vertical; }
.input-group { display: flex; align-items: center; gap: var(--sp-3);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-pill);
  padding: 0.35em 0.45em 0.35em 1.1em; transition: border-color .18s var(--ease), box-shadow .18s var(--ease); }
.input-group:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.input-group svg { width: 1.25em; height: 1.25em; color: var(--ink-3); flex: none; }
.input-group input { flex: 1; border: none; background: none; outline: none; padding: 0.45em 0; min-width: 0; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}

/* Restaurant card */
.rcard { overflow: hidden; display: flex; flex-direction: column; }
.rcard:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: transparent; }
.rcard__media { position: relative; aspect-ratio: 16 / 3.7; overflow: hidden; }
/* บังคับรูป/placeholder เต็มกรอบเสมอ → ทุกการ์ดสูงเท่ากันไม่ว่ารูปแนวตั้งหรือแนวนอน */
.rcard__media > img,
.rcard__media > .ph { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.rcard__fav {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%;
  background: color-mix(in oklab, var(--surface) 80%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid var(--border); color: var(--ink-2); cursor: pointer;
  transition: all .18s var(--ease);
}
.rcard__fav:hover { transform: scale(1.08); color: var(--brand); }
.rcard__fav.is-saved { background: var(--brand); color: var(--on-brand); border-color: transparent; }
.rcard__fav svg { width: 18px; height: 18px; }
.rcard__badges { position: absolute; left: 12px; top: 12px; display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.rcard__body { padding: var(--sp-4) var(--sp-4) var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-3); flex: 1; }
.rcard__head { display: flex; align-items: start; justify-content: space-between; gap: var(--sp-3); }
.rcard__title { font-size: var(--fs-h3); font-weight: var(--fw-bold); letter-spacing: -0.02em; }
.rcard__meta { display: flex; align-items: center; gap: 0.5em; color: var(--ink-3); font-size: var(--fs-sm); }
.rcard__meta .sep { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.rcard__tags { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.rcard__foot { margin-top: auto; padding-top: var(--sp-3); border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.tag-sm { font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--ink-3); white-space: nowrap;
  background: var(--surface-2); padding: 0.3em 0.65em; border-radius: var(--r-pill); }

/* ============================================================
   VENUE CARD · "Pin Rail" (หน้าแรก: ร้านล่าสุด/ฮิต)
   แถบหมุดลายจุดซ้าย แทนแถบสีเต็มหัว — ดีไซน์ 04 Pin Rail
   ============================================================ */
.vcard { display: flex; overflow: hidden; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-md);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.vcard:hover { transform: translateY(-3px);
  box-shadow: 0 14px 30px -14px color-mix(in oklab, var(--ink) 24%, transparent); }
.vcard--link { position: relative; cursor: pointer; }
.vcard--link .vcard__go::after { content: ""; position: absolute; inset: 0; z-index: 0; }

.vcard__rail { flex: none; width: 38px; display: flex; justify-content: center; padding-top: 18px;
  background-color: var(--surface-2);
  background-image: radial-gradient(color-mix(in oklab, var(--brand) 20%, var(--border-strong)) 1.1px, transparent 1.2px);
  background-size: 11px 11px; border-right: 1px solid var(--border); }
.vcard__pin { width: 26px; height: 26px; border-radius: 50%; background: var(--brand-strong); color: var(--on-brand);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 9px -3px color-mix(in oklab, var(--brand-strong) 55%, transparent); }

.vcard__body { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: var(--sp-4); }
.vcard__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); }
.vcard__title { margin: 0; font-size: 1.0625rem; font-weight: var(--fw-semibold); line-height: 1.3; letter-spacing: -0.01em; }
.vcard__go { color: inherit; text-decoration: none; }
.vcard__cat { align-self: flex-start; margin-top: var(--sp-2); font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  letter-spacing: 0.03em; color: var(--brand-strong); background: var(--brand-softer); padding: 4px 10px; border-radius: var(--r-sm); }
.vcard__area { display: flex; align-items: center; gap: 5px; margin-top: var(--sp-2);
  font-size: var(--fs-sm); color: var(--ink-3); }
.vcard__area svg { flex: none; }
.vcard__area span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vcard__desc { margin: var(--sp-3) 0 0; font-size: var(--fs-sm); line-height: 1.6; color: var(--ink-2); flex: 1; }
.vcard__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--border); }
.vcard__by { display: inline-flex; align-items: center; gap: 7px; min-width: 0;
  font-size: var(--fs-sm); color: var(--ink-3); }
.vcard__by .fm-frame { flex: none; }
.vcard__by-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--fs-xs); }
.vcard__by-name b { color: var(--ink); font-weight: var(--fw-semibold); }

.vcard__chk { flex: none; display: inline-flex; align-items: center; gap: 4px; margin-top: 1px;
  padding: 4px 9px; border-radius: var(--r-pill); font-size: 0.72rem; font-weight: var(--fw-bold); white-space: nowrap; }
.vcard__chk--empty  { border: 1px solid var(--border-strong); color: var(--ink-3); }
.vcard__chk--on     { background: var(--brand-strong); color: var(--on-brand); }
.vcard__chk--rating { background: var(--brand-softer); color: var(--brand-strong); }

.vcard__more { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 5px;
  color: var(--brand-strong); font-size: var(--fs-sm); font-weight: var(--fw-semibold); text-decoration: none; white-space: nowrap;
  transition: gap .15s var(--ease); }
.vcard__more:hover { gap: 9px; }

/* Stat / profile card */
.stat { display: flex; flex-direction: column; gap: 0.2em; padding: var(--sp-4); }
.stat__num { font-size: var(--fs-h2); font-weight: var(--fw-bold); letter-spacing: -0.03em; }
.stat__label { font-size: var(--fs-sm); color: var(--ink-3); }

/* ============================================================
   IMAGE PLACEHOLDER (striped — drop real photos here later)
   ============================================================ */
.ph {
  position: relative; width: 100%; height: 100%;
  background-color: var(--surface-3);
  background-image: repeating-linear-gradient(135deg,
      transparent 0 11px,
      color-mix(in oklab, var(--ink-3) 9%, transparent) 11px 12px);
  display: grid; place-items: center; color: var(--ink-3); overflow: hidden;
}
.ph::after {
  content: attr(data-label);
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-3);
  background: var(--surface); padding: 0.3em 0.7em; border-radius: var(--r-pill);
  border: 1px solid var(--border);
}
.avatar { border-radius: 50%; overflow: hidden; flex: none; background: var(--surface-3); }
.avatar .ph::after { display: none; }

/* placeholder การ์ดที่ยังไม่มีรูป: แถบไล่สี สีต่างกันตามหมวดหมู่ (ไม่มีอิโมจิ/ป้าย) */
.ph--cat { background-image: linear-gradient(135deg, color-mix(in oklab, #d9d4ec 50%, white), color-mix(in oklab, #a99fd6 50%, white)); }
.ph--cat::after { content: none; }
.ph--c-food    { background-image: linear-gradient(135deg, color-mix(in oklab, #ffb347 50%, white), color-mix(in oklab, #ff6a5e 50%, white)); }
.ph--c-cafe    { background-image: linear-gradient(135deg, color-mix(in oklab, #cfa07a 50%, white), color-mix(in oklab, #8b5e3c 50%, white)); }
.ph--c-dessert { background-image: linear-gradient(135deg, color-mix(in oklab, #ffd1ec 50%, white), color-mix(in oklab, #ff8fc7 50%, white)); }
.ph--c-bbq     { background-image: linear-gradient(135deg, color-mix(in oklab, #e76f51 50%, white), color-mix(in oklab, #9b2226 50%, white)); }
.ph--c-shabu   { background-image: linear-gradient(135deg, color-mix(in oklab, #ff9a76 50%, white), color-mix(in oklab, #e23e57 50%, white)); }
.ph--c-bar     { background-image: linear-gradient(135deg, color-mix(in oklab, #9b8cf2 50%, white), color-mix(in oklab, #5b2a86 50%, white)); }
.ph--c-travel  { background-image: linear-gradient(135deg, color-mix(in oklab, #4fd1c5 50%, white), color-mix(in oklab, #2b6cb0 50%, white)); }
.ph--c-other   { background-image: linear-gradient(135deg, color-mix(in oklab, #d9d4ec 50%, white), color-mix(in oklab, #a99fd6 50%, white)); }
