/* The Curry Index
   Concept: a Bradford curry-house shopfront. Red fascia with gold sign lettering,
   then a plain white page where the data does the talking: every takeaway as a
   dot on a price ruler, a foil-tray price list beside the map. */

:root {
  --paper: #ffffff;
  --ink: #26150f;
  --ink-soft: #6c5d55;
  --rule: #e6ddd5;
  --fascia: #8a1f17;
  --fascia-deep: #6c160f;
  --gold: #e4b04a;
  --foil: #eef0f1;
  --foil-edge: #d9dde0;
  /* price heat: cheaper to dearer */
  --heat-low: #d08a12;
  --heat-mid: #d0571f;
  --heat-high: #9c2315;
  --on-heat: #ffffff;
  --ok: #2e6b3f;
  --focus: #1f5fd1;
  --font-sign: "Young Serif", Georgia, "Times New Roman", serif;
  --font-text: "Schibsted Grotesk", "Helvetica Neue", Arial, system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
  --measure: 66ch;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1b1311; --ink: #f3ebe4; --ink-soft: #b3a59c; --rule: #3a2c27;
    --fascia: #7a1b14; --fascia-deep: #5c130d; --gold: #e9bb5c;
    --foil: #262021; --foil-edge: #3a3233;
    --heat-low: #e8b23a; --heat-mid: #ec8435; --heat-high: #f0534e; --on-heat: #1b1311;
    --ok: #79c48e; --focus: #8ab4ff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #1b1311; --ink: #f3ebe4; --ink-soft: #b3a59c; --rule: #3a2c27;
  --fascia: #7a1b14; --fascia-deep: #5c130d; --gold: #e9bb5c;
  --foil: #262021; --foil-edge: #3a3233;
  --heat-low: #e8b23a; --heat-mid: #ec8435; --heat-high: #f0534e; --on-heat: #1b1311;
  --ok: #79c48e; --focus: #8ab4ff;
  color-scheme: dark;
}

/* ---- base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.55 var(--font-text);
}
h1, h2, h3 { text-wrap: balance; margin: 0; }
h2 { font: 400 clamp(26px, 3vw, 34px)/1.15 var(--font-sign); letter-spacing: -.005em; }
h3 { font: 600 17px/1.3 var(--font-text); }
p { margin: 0; }
a { color: inherit; text-underline-offset: 3px; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); color: var(--ink); padding: 8px 12px; z-index: 2000; }
.skip:focus { left: 8px; }
.wrap { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: var(--gutter); }
.num { text-align: right; }

/* ---- sample banner ---------------------------------------------------------- */
.sample-banner { background: var(--ink); color: var(--paper); font-size: 14px; padding: 9px var(--gutter); text-align: center; }
.sample-banner strong { color: var(--gold); }

/* ---- fascia (the shop sign) ---------------------------------------------- */
.fascia {
  background: var(--fascia);
  color: var(--gold);
  border-bottom: 6px solid var(--fascia-deep);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .08);
}
.fascia-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 32px; padding-block: 18px 16px; }
.wordmark {
  font: 400 clamp(30px, 4.4vw, 46px)/1 var(--font-sign);
  color: var(--gold);
  text-decoration: none;
  letter-spacing: -.01em;
  text-shadow: 0 1px 0 var(--fascia-deep), 0 2px 0 rgba(0, 0, 0, .18);
}
.wm-the { font-size: .62em; vertical-align: .18em; }
.fascia-nav { display: flex; flex-wrap: wrap; gap: 4px 22px; font-weight: 500; font-size: 15px; }
.fascia-nav a { color: #f6e3dd; text-decoration: none; padding-block: 4px; border-bottom: 1px solid transparent; }
.fascia-nav a:hover { border-bottom-color: var(--gold); color: #fff; }

/* ---- hero: the price ruler ---------------------------------------------- */
.hero { padding-block: clamp(32px, 5vw, 64px) 8px; }
.city-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.city-picker button {
  font: 500 15px/1 var(--font-text); padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink); cursor: pointer;
}
.city-picker button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.hero-title {
  font: 400 clamp(36px, 5.6vw, 68px)/1.04 var(--font-sign);
  letter-spacing: -.015em;
  max-width: 17ch;
}
.hero-sub { margin-top: 18px; font-size: clamp(18px, 1.6vw, 21px); color: var(--ink-soft); max-width: 52ch; }

.strip { margin: clamp(28px, 4vw, 44px) 0 0; }
.strip-chart { width: 100%; min-height: 150px; }
.strip-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.st-axis { stroke: var(--ink); stroke-width: 1.5; }
.st-tick { stroke: var(--ink); stroke-width: 1; }
.st-tick-label { font: 500 13px var(--font-text); fill: var(--ink-soft); font-variant-numeric: tabular-nums; }
.st-dot { stroke: var(--paper); stroke-width: 1.5; cursor: pointer; }
.st-dot:hover, .st-dot.is-active { stroke: var(--ink); stroke-width: 2.5; }
.st-dot.is-low { fill: var(--heat-low); }
.st-dot.is-mid { fill: var(--heat-mid); }
.st-dot.is-high { fill: var(--heat-high); }
.st-dot.is-other { fill: var(--paper); stroke: var(--ink-soft); stroke-dasharray: 2 2; }
.st-avg { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 3 4; }
.st-avg-price { font: 400 30px var(--font-sign); fill: var(--ink); }
.st-avg-label { font: 500 14px var(--font-text); fill: var(--ink-soft); }
.strip-empty { padding: 36px 0; color: var(--ink-soft); border-top: 1.5px solid var(--ink); }

.strip-ends { display: flex; justify-content: space-between; gap: 24px; margin-top: 14px; }
.strip-end { display: grid; gap: 2px; max-width: 46%; }
.strip-high { text-align: right; justify-items: end; }
.end-label { font-size: 14px; color: var(--ink-soft); }
.end-price { font: 400 26px/1.1 var(--font-sign); }
.strip-low .end-price { color: var(--heat-low); }
.strip-high .end-price { color: var(--heat-high); }
.end-name { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }

.hero-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px;
  margin-top: clamp(28px, 4vw, 40px); padding-top: 20px; border-top: 1px solid var(--rule);
}
.hero-meta { color: var(--ink-soft); font-size: 15px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---- buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: 600 16px/1 var(--font-text); padding: 14px 20px; border-radius: 6px; cursor: pointer;
  background: var(--fascia); color: #fff; border: 1.5px solid var(--fascia); text-decoration: none;
}
.btn:hover { background: var(--fascia-deep); border-color: var(--fascia-deep); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-quiet:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---- board: foil tray + map ----------------------------------------------- */
.board {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 24px;
  padding-block: clamp(40px, 6vw, 72px) 0; align-items: stretch;
}
.tray {
  background: var(--foil);
  border: 1px solid var(--foil-edge);
  border-radius: 14px 14px 6px 6px;
  display: flex; flex-direction: column; min-width: 0; max-height: 660px;
}
.tray-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px 14px; }
.tray-title { font-size: 26px; }
.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--paper); border-radius: 999px; border: 1px solid var(--foil-edge); }
.tabs button {
  font: 500 14px/1 var(--font-text); padding: 8px 13px; background: transparent; color: var(--ink-soft);
  border: 0; border-radius: 999px; cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.search { padding: 0 20px 8px; }
.search input, .field input, .field textarea {
  width: 100%; font: 400 16px/1.4 var(--font-text); color: var(--ink); background: var(--paper);
  border: 1px solid var(--foil-edge); border-radius: 6px; padding: 11px 12px;
}
.field input, .field textarea { border-color: var(--rule); }
.search input:focus, .field input:focus, .field textarea:focus { border-color: var(--ink); outline: 2px solid var(--focus); outline-offset: 1px; }
.menu-list { list-style: none; margin: 0; padding: 0 8px 8px; overflow-y: auto; flex: 1; min-height: 240px; }
.menu-item button {
  width: 100%; display: flex; align-items: baseline; gap: 10px; padding: 10px 12px;
  background: none; border: 0; border-radius: 6px; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.menu-item + .menu-item button { border-top: 1px solid var(--foil-edge); border-radius: 0; }
.menu-item button:hover { background: var(--paper); }
.mi-no { font-size: 13px; color: var(--ink-soft); min-width: 1.8em; font-variant-numeric: tabular-nums; }
.mi-no:empty { display: none; }
.mi-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.mi-area { font-weight: 400; color: var(--ink-soft); font-size: 14px; margin-left: 6px; }
.mi-dish { display: block; font-weight: 400; font-size: 13px; color: var(--ink-soft); font-style: italic; }
.mi-dots { flex: 1; min-width: 14px; border-bottom: 2px dotted color-mix(in srgb, var(--ink) 30%, transparent); transform: translateY(-5px); }
.mi-price { font: 400 21px/1 var(--font-sign); }
.mi-price.is-low { color: var(--heat-low); }
.mi-price.is-mid { color: var(--heat-mid); }
.mi-price.is-high { color: var(--heat-high); }
.menu-empty { padding: 20px; color: var(--ink-soft); }
.menu-foot { padding: 12px 20px 16px; font-size: 14px; color: var(--ink-soft); border-top: 1px solid var(--foil-edge); }

.map-wrap { display: grid; grid-template-rows: 1fr auto; gap: 10px; min-width: 0; }
#map { height: 100%; min-height: 480px; border-radius: 6px; border: 1px solid var(--rule); background: var(--foil); z-index: 0; }
#map.no-tiles {
  background-image:
    linear-gradient(color-mix(in srgb, var(--ink) 7%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--ink) 7%, transparent) 1px, transparent 1px);
  background-size: 48px 48px;
}
#map.no-tiles .leaflet-tile-pane { display: none; }
.map-note { font-size: 14px; color: var(--ink-soft); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.key { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.key.is-low { background: var(--heat-low); }
.key.is-mid { background: var(--heat-mid); }
.key.is-high { background: var(--heat-high); }
.key.is-other { background: var(--paper); border: 1.5px dashed var(--ink-soft); }

/* ---- map pins (Leaflet divIcons) ------------------------------------------- */
.pin-wrap { background: none; border: 0; }
.pin {
  position: absolute; left: 0; top: 0; transform: translate(-50%, calc(-100% - 7px));
  font: 600 13px/1 var(--font-text); white-space: nowrap;
  padding: 6px 8px; border-radius: 5px; background: var(--heat-mid); color: var(--on-heat);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .2), 0 3px 8px rgba(0, 0, 0, .18); cursor: pointer;
}
.pin::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  border: 6px solid transparent; border-bottom: 0; border-top-color: var(--heat-mid);
}
.pin.is-low { background: var(--heat-low); }
.pin.is-mid { background: var(--heat-mid); }
.pin.is-high { background: var(--heat-high); }
.pin.is-other { background: var(--paper); color: var(--ink); border: 1.5px dashed var(--ink-soft); }
.pin.is-low::after { border-top-color: var(--heat-low); }
.pin.is-mid::after { border-top-color: var(--heat-mid); }
.pin.is-high::after { border-top-color: var(--heat-high); }
.pin.is-other::after { border-top-color: var(--ink-soft); }
.pin.is-active { outline: 3px solid var(--ink); outline-offset: 2px; z-index: 1000; }
#map.pins-dots .pin { font-size: 0; padding: 0; width: 13px; height: 13px; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 0 1.5px var(--paper); }
#map.pins-dots .pin::after { display: none; }
#map.pins-dots .pin.is-active { font-size: 13px; padding: 6px 8px; width: auto; height: auto; border-radius: 5px; transform: translate(-50%, calc(-100% - 7px)); }
#map.pins-dots .pin.is-active::after { display: block; }
.leaflet-popup-content-wrapper { border-radius: 6px; background: var(--paper); color: var(--ink); box-shadow: 0 6px 20px rgba(0, 0, 0, .2); }
.leaflet-popup-tip { background: var(--paper); }
.leaflet-popup-content { margin: 12px 14px; font: 400 14px/1.45 var(--font-text); }
.pop-name { font-weight: 600; font-size: 15px; }
.pop-price { font: 400 30px/1.1 var(--font-sign); margin: 4px 0; }
.pop-meta { color: var(--ink-soft); font-size: 13px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--ink-soft); }
.leaflet-control-attribution { font-size: 11px; }
.leaflet-bar a { background-color: var(--paper); color: var(--ink); border-bottom-color: var(--rule); }
.leaflet-bar a:hover, .leaflet-bar a:focus { background-color: var(--foil); }
.leaflet-container .leaflet-control-attribution { background: color-mix(in srgb, var(--paper) 85%, transparent); color: var(--ink-soft); }
.leaflet-container .leaflet-control-attribution a { color: var(--ink); }

/* ---- sections -------------------------------------------------------------- */
.section { padding-block: clamp(48px, 7vw, 88px) 0; display: grid; gap: 20px; }
.section
.section-head { display: grid; gap: 8px; max-width: var(--measure); }
.section-lede { color: var(--ink-soft); }

/* Area chart */
.dotplot { overflow-x: auto; border-top: 1.5px solid var(--ink); padding-top: 8px; }
.dotplot svg { display: block; width: 100%; min-width: 520px; height: auto; }
.dp-label { font: 600 14px var(--font-text); fill: var(--ink); }
.dp-count { font: 400 13px var(--font-text); fill: var(--ink-soft); }
.dp-axis { font: 500 13px var(--font-text); fill: var(--ink-soft); font-variant-numeric: tabular-nums; }
.dp-grid { stroke: var(--rule); stroke-width: 1; }
.dp-range { stroke: color-mix(in srgb, var(--ink) 35%, transparent); stroke-width: 3; stroke-linecap: round; }
.dp-avg { fill: var(--fascia); stroke: var(--paper); stroke-width: 2; }
.dp-city { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 3 4; }
.dp-value { font: 600 13px var(--font-text); fill: var(--ink); }

/* League table */
.table-scroll { overflow-x: auto; border-top: 1.5px solid var(--ink); }
.league { width: 100%; border-collapse: collapse; min-width: 560px; }
.league th, .league td { padding: 13px 14px 13px 0; border-bottom: 1px solid var(--rule); text-align: left; }
.league thead th { font-size: 14px; font-weight: 500; color: var(--ink-soft); }
.league td.pos { font: 400 22px/1 var(--font-sign); width: 3.5em; font-variant-numeric: lining-nums; }
.league td.city { font-weight: 600; }
.league td.avg { font: 400 22px/1 var(--font-sign); font-variant-numeric: lining-nums; }
.league tr.is-current td { background: color-mix(in srgb, var(--gold) 16%, transparent); }
.league .city-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.league-empty td { color: var(--ink-soft); }

/* How it works (a real sequence, so numbered) */
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; }
.steps li { counter-increment: step; display: grid; gap: 6px; align-content: start; min-width: 0; }
.steps li::before {
  content: counter(step);
  display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 8px;
  border-radius: 50%; background: var(--fascia); color: var(--gold);
  font: 400 20px/1 var(--font-sign);
}
.steps p { color: var(--ink-soft); font-size: 16px; }
.fineprint { font-size: 15px; color: var(--ink-soft); max-width: var(--measure); }

/* Forms */
.forms { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 24px; }
.panel { background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; padding: clamp(20px, 3vw, 28px); display: grid; gap: 16px; min-width: 0; }
.panel:first-child { border-top: 4px solid var(--fascia); }
.panel h2 { font-size: 26px; }
.panel > p { color: var(--ink-soft); }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field label, .field legend { font-weight: 600; font-size: 15px; }
.field legend { margin-bottom: 6px; padding: 0; }
.optional { font-weight: 400; color: var(--ink-soft); }
.choice { display: flex; align-items: center; gap: 10px; font-weight: 400 !important; padding: 3px 0; }
.choice input { width: 18px; height: 18px; accent-color: var(--fascia); }
input[type="file"] { font: inherit; padding: 9px; }
.form-status { font-size: 15px; min-height: 1.4em; }
.form-status.is-ok { color: var(--ok); font-weight: 600; }
.form-status.is-error { color: var(--heat-high); font-weight: 600; }

/* Footer: the fascia again, closing the shop */
.foot { margin-top: clamp(56px, 8vw, 96px); background: var(--fascia); color: #f6e3dd; padding-block: 32px calc(32px + env(safe-area-inset-bottom, 0px)); border-top: 6px solid var(--fascia-deep); }
.foot-inner { display: grid; gap: 10px; }
.foot-mark { font: 400 26px/1 var(--font-sign); color: var(--gold); margin-bottom: 6px; }
.foot strong { color: #fff; }
.foot-small { font-size: 14px; color: rgba(246, 227, 221, .75); }
.copyable { user-select: all; font-weight: 600; color: #fff; overflow-wrap: anywhere; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 6px; font-weight: 600;
  max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0, 0, 0, .25); z-index: 3000; overflow-wrap: anywhere;
}

/* ---- responsive -------------------------------------------------------------- */
@media (max-width: 960px) {
  .board { grid-template-columns: 1fr; }
  .tray { max-height: 540px; }
  #map { min-height: 400px; }
  .forms { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .fascia-nav { display: none; }
  .steps { grid-template-columns: 1fr; gap: 20px; }
  .strip-end { max-width: 48%; }
  .end-price { font-size: 22px; }
  .hero-actions, .hero-actions .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Young Serif defaults to old-style figures; prices read better lining.
   Kept last so the font shorthands above don't reset it. */
.wordmark, .hero-title, h2, .st-avg-price, .end-price, .mi-price, .pop-price,
.league td.pos, .league td.avg, .steps li::before, .foot-mark { font-variant-numeric: lining-nums; }
