/* A Map to the Best Burger */

:root {
  --bg: #FBF6EE;
  --surface: #FFFFFF;
  --surface-2: #F5EDE1;
  --text: #2A1D14;
  --muted: #7A6656;
  --border: #EADFD0;
  --accent: #C8432A;          /* ketchup */
  --accent-ink: #FFFFFF;
  --mustard: #E9A23B;
  --lettuce: #5E8C3A;
  --shadow: 0 1px 2px rgba(42, 29, 20, .06), 0 6px 20px rgba(42, 29, 20, .06);

  /* score heat: low → high */
  --heat-0: #D9CFC3;  --heat-0-ink: #4A3B2F;
  --heat-1: #E8D3B0;  --heat-1-ink: #4A3B2F;
  --heat-2: #F2C063;  --heat-2-ink: #3B2A10;
  --heat-3: #EE8C3A;  --heat-3-ink: #FFFFFF;
  --heat-4: #D9542C;  --heat-4-ink: #FFFFFF;
  --heat-5: #A8261B;  --heat-5-ink: #FFFFFF;

  --radius: 14px;
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17120E;
    --surface: #211A15;
    --surface-2: #2B221B;
    --text: #F5ECE1;
    --muted: #B5A391;
    --border: #3A2E25;
    --accent: #F06A43;
    --accent-ink: #1A0F09;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --heat-0: #3A2F27;  --heat-0-ink: #D8C9B9;
    --heat-1: #5A4632;  --heat-1-ink: #F5ECE1;
    --heat-2: #B9862F;  --heat-2-ink: #1A0F09;
    --heat-3: #E07F33;  --heat-3-ink: #1A0F09;
    --heat-4: #E5603A;  --heat-4-ink: #1A0F09;
    --heat-5: #F0866A;  --heat-5-ink: #1A0F09;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17120E; --surface: #211A15; --surface-2: #2B221B; --text: #F5ECE1; --muted: #B5A391;
  --border: #3A2E25; --accent: #F06A43; --accent-ink: #1A0F09;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  --heat-0: #3A2F27; --heat-0-ink: #D8C9B9; --heat-1: #5A4632; --heat-1-ink: #F5ECE1;
  --heat-2: #B9862F; --heat-2-ink: #1A0F09; --heat-3: #E07F33; --heat-3-ink: #1A0F09;
  --heat-4: #E5603A; --heat-4-ink: #1A0F09; --heat-5: #F0866A; --heat-5-ink: #1A0F09;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.55 var(--font-body);
  overflow-x: hidden;
}
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); font-weight: 800; }
h2 { font-size: 1.45rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* ── Header ── */
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 1000; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font: 500 .85rem/1.1 var(--font-display); }
.brand strong { font-size: 1.15rem; font-weight: 800; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 999px; font-weight: 500; font-size: .95rem; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--accent-ink); background: var(--accent); }

.custom-banner { background: var(--mustard); color: #2A1D14; font-size: .92rem; }
.custom-banner .wrap { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding-top: 8px; padding-bottom: 8px; flex-wrap: wrap; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; color: inherit; }

main { padding-top: 28px; padding-bottom: 48px; min-height: 60vh; }
.loading, .error { padding: 60px 0; text-align: center; color: var(--muted); }
.error { color: var(--accent); }

.site-footer { border-top: 1px solid var(--border); padding: 20px 0 32px; color: var(--muted); font-size: .85rem; }

/* ── Shared bits ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600;
        background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip.good { background: color-mix(in srgb, var(--lettuce) 18%, transparent); color: var(--lettuce); }
.chip.warn { background: color-mix(in srgb, var(--mustard) 25%, transparent); color: var(--text); }
.chip.hot  { background: var(--accent); color: var(--accent-ink); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }

.score { display: inline-grid; place-items: center; font: 800 1.35rem/1 var(--font-display); border-radius: 12px;
         min-width: 58px; height: 58px; padding: 0 8px; font-variant-numeric: tabular-nums; }
.score.sm { min-width: 40px; height: 32px; font-size: .95rem; border-radius: 8px; }
.score.lg { min-width: 92px; height: 92px; font-size: 2.4rem; border-radius: 20px; }
.heat-0 { background: var(--heat-0); color: var(--heat-0-ink); }
.heat-1 { background: var(--heat-1); color: var(--heat-1-ink); }
.heat-2 { background: var(--heat-2); color: var(--heat-2-ink); }
.heat-3 { background: var(--heat-3); color: var(--heat-3-ink); }
.heat-4 { background: var(--heat-4); color: var(--heat-4-ink); }
.heat-5 { background: var(--heat-5); color: var(--heat-5-ink); }

.tabs { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.tabs button { border: 0; background: none; font: 600 .9rem var(--font-body); color: var(--muted); padding: 7px 14px; border-radius: 999px; cursor: pointer; }
.tabs button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
       font: 600 .9rem var(--font-body); padding: 9px 14px; border-radius: 10px; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--surface-2); }

.avatar { width: 56px; height: 56px; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar svg { width: 34px; height: 34px; }

/* ── Home ── */
.hero { margin-bottom: 22px; }
.hero p { color: var(--muted); max-width: 640px; font-size: 1.05rem; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.score-desc { color: var(--muted); font-size: .9rem; }

.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 460px); gap: 24px; align-items: start; }
.map-panel { position: sticky; top: 84px; height: min(70vh, 620px); overflow: hidden; }
.map { width: 100%; height: 100%; border-radius: var(--radius); }

.rank-list { display: grid; gap: 12px; list-style: none; margin: 0; padding: 0; }
.rank-card { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 16px;
             text-decoration: none; color: inherit; transition: transform .12s ease, border-color .12s ease; }
.rank-card:hover { transform: translateY(-1px); border-color: var(--mustard); }
.rank-num { font: 800 1.6rem/1 var(--font-display); color: var(--muted); width: 1.6em; text-align: center; }
.rank-card h3 { margin: 0 0 2px; font-size: 1.15rem; }
.rank-meta { color: var(--muted); font-size: .88rem; margin-bottom: 6px; }
.rank-scores { display: grid; justify-items: end; gap: 6px; }
.rank-sub { display: flex; gap: 10px; font-size: .78rem; color: var(--muted); }
.rank-sub b { color: var(--text); font-variant-numeric: tabular-nums; }

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

/* map pins */
.pin { background: none; border: 0; }
.pin span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg);
            box-shadow: 0 2px 6px rgba(0, 0, 0, .3); border: 2px solid var(--surface); }
.pin b { transform: rotate(45deg); font: 800 .85rem var(--font-display); }
.leaflet-container { font-family: var(--font-body); background: var(--surface-2); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--text); }
.leaflet-popup-content a { font-weight: 600; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9); }
}
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9); }

/* ── Place page ── */
.back { display: inline-block; margin-bottom: 14px; text-decoration: none; font-weight: 600; font-size: .92rem; }
.place-hero { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 20px; align-items: center; padding: 22px; margin-bottom: 20px; }
.place-hero .avatar { width: 84px; height: 84px; border-radius: 20px; }
.place-hero .avatar svg { width: 52px; height: 52px; }
.place-hero h1 { margin-bottom: 4px; font-size: clamp(1.8rem, 4vw, 2.6rem); }
.hero-scores { display: flex; gap: 14px; align-items: center; }
.hero-scores .others { display: grid; gap: 6px; }
.stat { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); }

.place-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px); gap: 20px; align-items: start; }
.section { padding: 20px; margin-bottom: 20px; }
.section > h2 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.section > h2 small { font: 500 .85rem var(--font-body); color: var(--muted); }

.burger-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.burger-row:first-of-type { border-top: 0; }
.lift { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .9rem; color: var(--muted); margin-top: 4px; }
.lift .arrow { color: var(--accent); font-weight: 700; }

.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr) 44px; gap: 10px; align-items: center; font-size: .92rem; }
.bar-row .label small { display: block; color: var(--muted); font-size: .75rem; }
.bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; }
.bar-row .val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar-row.unrated { color: var(--muted); }
details.sub { margin: -4px 0 4px; }
details.sub summary { cursor: pointer; color: var(--muted); font-size: .82rem; margin-left: 2px; }
details.sub .bars { margin: 10px 0 6px 12px; gap: 8px; }
details.sub .bar-row { font-size: .85rem; }

.list { list-style: none; padding: 0; margin: 0; }
.list > li { padding: 12px 0; border-top: 1px solid var(--border); }
.list > li:first-child { border-top: 0; padding-top: 0; }
.mini-map { height: 200px; border-radius: 10px; margin-bottom: 12px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ── Weights page ── */
.weights-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 20px; align-items: start; }
.preview { position: sticky; top: 84px; padding: 18px; }
.preview ol { margin: 0; padding-left: 1.3em; }
.preview li { padding: 6px 0; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.slider-row { display: grid; grid-template-columns: minmax(0, 170px) minmax(0, 1fr) 54px; gap: 12px; align-items: center; padding: 8px 0; }
.slider-row label { font-weight: 600; font-size: .95rem; }
.slider-row label small { display: block; font-weight: 400; color: var(--muted); font-size: .76rem; }
.slider-row output { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; font-size: .9rem; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.group-card { padding: 16px 18px; margin-bottom: 14px; }
.group-card details summary { cursor: pointer; color: var(--muted); font-size: .85rem; margin-top: 4px; }
.group-card .children { border-left: 2px solid var(--border); margin: 8px 0 0 4px; padding-left: 14px; }
.group-card .children .slider-row label { font-weight: 500; }
.toggle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; margin-top: 10px; }
.toggle-grid label { display: flex; gap: 8px; align-items: center; font-size: .9rem; cursor: pointer; }
.toggle-grid input { accent-color: var(--accent); width: 16px; height: 16px; }

/* ── Tier list ── */
.tier { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px;
        font: 800 1.05rem/1 var(--font-display); color: #1A0F09; }
.tier.sm { width: 24px; height: 22px; font-size: .78rem; border-radius: 6px; }
.tier.xs { width: 20px; height: 18px; font-size: .7rem; border-radius: 5px; vertical-align: middle; }
.tier-S { background: #FF7F7F; } .tier-A { background: #FFBF7F; } .tier-B { background: #FFDF7F; }
.tier-C { background: #F4F07A; } .tier-D { background: #BFF08A; } .tier-F { background: #9ED8E8; }

.tier-board { overflow: hidden; padding: 0; }
.tier-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); border-top: 1px solid var(--border); min-height: 92px; }
.tier-row:first-child { border-top: 0; }
.tier-label { display: grid; place-content: center; text-align: center; color: #1A0F09; }
.tier-label span { font: 800 2.2rem/1 var(--font-display); }
.tier-label small { font-size: .72rem; font-weight: 600; opacity: .75; margin-top: 4px; }
.tier-items { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px; align-items: center; background: var(--surface); }
.tier-empty { color: var(--muted); font-size: .88rem; }
.tier-card { display: flex; gap: 10px; align-items: center; padding: 8px 12px 8px 8px; border-radius: 12px; background: var(--surface-2);
             text-decoration: none; color: var(--text); border: 1px solid var(--border); max-width: 100%; }
.tier-card:hover { border-color: var(--mustard); }
.tier-card .avatar { width: 48px; height: 48px; border-radius: 10px; }
.tier-card .avatar svg { width: 30px; height: 30px; }
.move-up { color: var(--lettuce); font-weight: 600; }
.move-down { color: var(--accent); font-weight: 600; }
.move-new { color: var(--mustard); font-weight: 600; }

/* ── How page ── */
.prose { max-width: 760px; }
.prose h2 { margin-top: 1.6em; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: .4em; }
.formula { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9rem; background: var(--surface-2);
           padding: 12px 14px; border-radius: 10px; overflow-x: auto; white-space: pre; }
.legend { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .home-grid, .place-grid, .weights-grid { grid-template-columns: minmax(0, 1fr); }
  .map-panel { position: relative; top: 0; height: 300px; order: -1; }
  .preview { position: relative; top: 0; }
}
@media (max-width: 560px) {
  .rank-card { grid-template-columns: auto minmax(0, 1fr) auto; }
  .rank-card .avatar { display: none; }
  .rank-sub { flex-direction: column; align-items: flex-end; gap: 0; }
  .place-hero { grid-template-columns: minmax(0, 1fr); }
  .place-hero .avatar { display: none; }
  .slider-row { grid-template-columns: minmax(0, 1fr) 54px; }
  .slider-row input { grid-column: 1 / -1; grid-row: 2; }
  .bar-row { grid-template-columns: minmax(0, 110px) minmax(0, 1fr) 40px; }
  .tier-row { grid-template-columns: 64px minmax(0, 1fr); }
  .tier-label span { font-size: 1.7rem; }
  .header-inner { padding-top: 8px; padding-bottom: 8px; }
}

/* ── Account picker ── */
.who { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); }
.who[hidden] { display: none; }
.who select, .field input, .field select, .field textarea {
  font: 400 1rem var(--font-body); color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; width: 100%; min-width: 0;
}
.who select { width: auto; padding: 6px 10px; font-size: .9rem; }
.field input:focus, .field select:focus, .field textarea:focus, .who select:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent;
}

/* ── Join page ── */
.join-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 320px); gap: 20px; align-items: start; }
.join-grid .section + .section { margin-top: 16px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .92rem; }
.field small { font-weight: 400; color: var(--muted); font-size: .8rem; }
.field.wide { grid-column: 1 / -1; }
.field[hidden], .slider-row[hidden] { display: none; }
.field .inline { display: flex; gap: 8px; }
.field .inline input { flex: 1; }
#where-status { margin: 12px 0 0; }
#where-status:empty { display: none; }
#join-map { margin: 12px 0 0; }
#join .slider-row { margin-top: 16px; }
#gut-preview { margin: 14px 0 0; }
.join-grid details summary { cursor: pointer; }
.sheet-group { margin: 18px 0 10px; font-size: 1rem; }
.checklist { margin: 0 0 14px; padding-left: 1.2em; }
.checklist li { padding: 3px 0; }
.checklist li.done { list-style: none; margin-left: -1.2em; color: var(--lettuce); }
.join-actions { display: flex; flex-direction: column; gap: 8px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); justify-content: center; }
.btn.primary:hover { filter: brightness(1.07); background: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.join-actions .btn { justify-content: center; }
@media (max-width: 900px) {
  .join-grid { grid-template-columns: minmax(0, 1fr); }
  .join-side { order: 2; }
}
@media (max-width: 560px) {
  .fields { grid-template-columns: minmax(0, 1fr); }
}

/* ── Environment badge (dev / staging only) ── */
.env-badge { display: none; }
body[data-env] .env-badge {
  display: inline-block; font: 700 .72rem var(--font-body); letter-spacing: .04em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px; background: var(--mustard); color: #2A1D14; white-space: nowrap; margin-right: auto;
}
body[data-env="dev"] .site-header { box-shadow: inset 0 -3px 0 var(--lettuce); }
body[data-env="staging"] .site-header { box-shadow: inset 0 -3px 0 var(--mustard); }

/* ── People ── */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.person-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; color: inherit; text-decoration: none; }
.person-card:hover { border-color: var(--accent); }
.person-card h3 { margin: 0; }
.person-head { display: flex; align-items: center; gap: 12px; }
.person-top { margin-left: auto; }
.person-initial { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--surface-2); font: 800 1.2rem var(--font-display); color: var(--accent); }
.private-note { color: var(--muted); margin: 0; }
.score-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.score-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; padding: 0 6px 8px; }
.score-table td { padding: 8px 6px; border-top: 1px solid var(--border); }
.score-table td:first-child { width: 100%; }
.opinion + .opinion { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.note { margin: 10px 0 0; padding: 8px 12px; border-left: 3px solid var(--mustard); background: var(--surface-2); border-radius: 0 8px 8px 0; }
.photo-strip { display: flex; gap: 10px; overflow-x: auto; }
.photo-strip img { height: 160px; border-radius: 10px; flex: none; }
.privacy-grid input:disabled + * , .privacy-grid label:has(input:disabled) { opacity: .5; }
.tier-board-card { padding: 0; overflow: hidden; }
.section .tier-board { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.bar > i.share-fill { background: var(--accent); }

/* honeypot: hidden from people, filled in by bots */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.narrow-form { max-width: 720px; }
.field input[type="file"] { padding: 7px; font-size: .9rem; }
