/* EPC Geocoder — design system v2 (docs/design.md revision 2).
   Field-notes cartographic energy × Apple-like minimalism × Esri Calcite
   palette (brand #007AC2, ink #151515, ground #F8F8F8). */

:root {
  --page: #F8F8F8;
  --surface: #FFFFFF;
  --ink: #151515;
  --text: #3F3F3F;
  --muted: #6A6A6A;
  --brand: #007AC2;
  --brand-hover: #00619B;
  --brand-wash: #EAF4FB;
  --border: #DCDCDC;
  --focus: #8FC3E8;
  --tier-property: #35AC46;
  --tier-property-bg: #EDF9EF;
  --tier-property-text: #1E7A2E;
  --tier-postcode: #F09E1D;
  --tier-postcode-bg: #FDF3E1;
  --tier-postcode-text: #8C5A0D;
  --tier-unmatched: #9B9B9B;
  --tier-unmatched-bg: #F1F1F1;
  --tier-unmatched-text: #4A4A4A;
  --danger: #D83020;
  --danger-bg: #FCEBE8;
  --font-display: 'Familjen Grotesk', 'Instrument Sans', -apple-system, sans-serif;
  --font-sans: 'Instrument Sans', -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { color: var(--ink); margin: 0 0 12px; }
h1 { font-family: var(--font-display); font-weight: 700; font-size: 40px; line-height: 1.1; letter-spacing: -0.02em; }
h2 { font-family: var(--font-display); font-weight: 700; font-size: 28px; line-height: 1.2; letter-spacing: -0.015em; }
h3 { font-weight: 600; font-size: 18px; line-height: 1.35; }
p { margin: 0 0 16px; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--font-mono); font-size: 90%; }
code.inline { background: var(--brand-wash); color: var(--brand-hover); padding: 2px 6px; border-radius: 5px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.prose { max-width: 720px; }

:is(a, button, input, select, summary):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Nav (translucent, blurred — Apple-like) ── */
.nav {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.nav .wrap { display: flex; align-items: center; gap: 28px; height: 60px; }
.brand { display: inline-flex; align-items: baseline; gap: 7px; color: var(--ink); font-weight: 600; font-size: 17px; font-family: var(--font-display); }
.brand:hover { text-decoration: none; }
.brand .brand-box {
  font-family: var(--font-mono); font-weight: 600; font-size: 13.5px;
  border: 1.5px solid var(--brand); color: var(--brand);
  border-radius: 6px; padding: 1px 6px 2px;
}
.nav nav { margin-left: auto; display: flex; gap: 24px; align-items: center; }
.nav nav a { color: var(--muted); font-size: 15px; }
.nav nav a:hover { color: var(--ink); text-decoration: none; }
.nav nav a.active { color: var(--ink); font-weight: 500; }

/* ── Buttons (pills) ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; font-family: var(--font-sans); font-size: 15px; font-weight: 500;
  height: 42px; padding: 0 20px; border-radius: 8px;
  border: 1px solid transparent; transition: background .15s, border-color .15s, transform .1s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.985); }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); }
.btn.secondary { background: var(--surface); border-color: #C9C9C9; color: var(--ink); }
.btn.secondary:hover { border-color: var(--brand); color: var(--brand); }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.ghost:hover { background: var(--brand-wash); }
.btn.danger { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger-bg); }
.btn:disabled { background: #EBEBEB; border-color: #EBEBEB; color: #9B9B9B; cursor: default; transform: none; }
.btn.lg { height: 50px; padding: 0 28px; font-size: 16px; }
.btn.sm { height: 34px; padding: 0 16px; font-size: 14px; }

/* ── Tier chips as map-legend keys ── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 12px; font-weight: 500;
  padding: 2px 9px 2px 7px; border-radius: 999px; line-height: 1.6; vertical-align: middle;
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none; }
.chip.property { background: var(--tier-property-bg); color: var(--tier-property-text); }
.chip.property::before { background: var(--tier-property); }
.chip.postcode { background: var(--tier-postcode-bg); color: var(--tier-postcode-text); }
.chip.postcode::before { background: var(--tier-postcode); }
.chip.unmatched { background: var(--tier-unmatched-bg); color: var(--tier-unmatched-text); }
.chip.unmatched::before { background: var(--tier-unmatched); }

/* ── Layout primitives ── */
.section { padding: 72px 0 0; margin-top: 72px; border-top: 1px solid var(--border); }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 26px;
  transition: transform .18s ease, box-shadow .18s ease;
}
.card.lift:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(21, 21, 21, 0.08); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

.notice { padding: 12px 16px; border-radius: var(--radius); font-size: 14px; margin: 14px 0; border: 1px solid; }
.notice.ok { background: var(--tier-property-bg); color: var(--tier-property-text); border-color: #C5E8CC; }
.notice.warn { background: var(--tier-postcode-bg); color: var(--tier-postcode-text); border-color: #F3DFB5; }
.notice.err { background: var(--danger-bg); color: var(--danger); border-color: #F3C4BC; }

.hidden { display: none !important; }

/* ── Source tiles (upload | ArcGIS) ── */
.source-tiles { align-items: stretch; }
.source-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 4px; padding: 40px 24px;
}
.source-tile .big, .dropzone .big { font-size: 17px; font-weight: 600; color: var(--ink); margin: 12px 0 4px; }
.source-tile .small { font-size: 14px; color: var(--muted); margin: 0 0 16px; max-width: 340px; }

/* ── Precision list ── */
.tiers-plain { display: grid; gap: 16px; max-width: 760px; margin-top: 20px; }
.tiers-plain > div { display: flex; gap: 14px; align-items: flex-start; }
.tiers-plain .chip { flex: none; margin-top: 3px; }
.tiers-plain p { margin: 0; font-size: 15px; }

/* ── FAQ (plain) ── */
.faq h3 { font-size: 16px; margin: 24px 0 6px; }
.faq p { color: var(--muted); font-size: 15px; max-width: 680px; margin: 0; }

/* ── Field mapping grid ── */
.field-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

/* ── Forms ── */
.field { margin: 0 0 16px; }
.field label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 8px; }
input[type="text"], input[type="email"], select {
  width: 100%; height: 42px; padding: 0 14px;
  background: var(--surface); border: 1px solid #C9C9C9; border-radius: var(--radius);
  color: var(--ink); font-family: inherit; font-size: 15px;
}
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px var(--focus); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236A6A6A' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 34px; }

/* ── Pricing (full-width band) ── */
.price-band {
  display: grid; grid-template-columns: 5fr 7fr; gap: 64px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 64px; margin-top: 28px;
}
.price-lead h2 { font-size: 34px; margin-bottom: 20px; }
.price-band .amount {
  font-family: var(--font-display); font-weight: 700; font-size: 96px;
  color: var(--ink); line-height: 1; letter-spacing: -0.03em; margin: 0 0 18px;
}
.price-band .amount small { font-family: var(--font-sans); font-weight: 400; font-size: 18px; color: var(--muted); letter-spacing: 0; }
.price-points {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 26px 32px;
}
.price-points li { padding-left: 30px; position: relative; }
.price-points li::before {
  content: ""; position: absolute; left: 2px; top: 7px; width: 13px; height: 8px;
  border-left: 2.5px solid var(--tier-property); border-bottom: 2.5px solid var(--tier-property);
  transform: rotate(-45deg);
}
.price-points b { display: block; font-weight: 600; color: var(--ink); font-size: 16px; margin-bottom: 3px; }
.price-points span { font-size: 14px; color: var(--muted); line-height: 1.5; }

/* ── Stepper (tool page) ── */
.stepper { display: flex; gap: 0; list-style: none; padding: 0; margin: 32px 0 40px; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface); }
.stepper li { flex: 1; display: flex; align-items: center; gap: 10px; padding: 13px 16px; font-size: 14px; color: var(--muted); border-left: 1px solid var(--border); }
.stepper li:first-child { border-left: none; }
.stepper li .n { font-family: var(--font-mono); font-size: 12px; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.stepper li.active { color: var(--ink); font-weight: 500; background: var(--brand-wash); }
.stepper li.active .n { border-color: var(--brand); color: var(--brand); }
.stepper li.done .n { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ── Dropzone ── */
.dropzone {
  border: 1.5px dashed #C2C8CD; border-radius: 14px; background: var(--surface);
  padding: 56px 24px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-wash); }
.dropzone .big { font-size: 17px; font-weight: 500; color: var(--ink); margin: 12px 0 4px; }
.dropzone .small { font-size: 14px; color: var(--muted); margin: 0; }

/* ── Progress ── */
.progress { height: 10px; background: var(--brand-wash); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.progress .fill { height: 100%; background: var(--brand); width: 0; transition: width .3s; }

/* ── Tables ── */
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
table.data td { padding: 8px 12px; border-bottom: 1px solid var(--border); }
table.data td.mono, .mono { font-family: var(--font-mono); font-size: 13px; }
.table-scroll { overflow-x: auto; }

/* ── Map ── */
.map-box { height: 400px; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.leaflet-container { font-family: var(--font-sans); }

/* ── Summary chips row ── */
.summary-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 16px 0; }
.summary-row .stat { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 8px 16px; font-size: 14px; }
.summary-row .stat b { font-family: var(--font-mono); font-weight: 500; color: var(--ink); }

/* ── Docs layout ── */
.docs-layout { display: grid; grid-template-columns: 220px 1fr; gap: 48px; align-items: start; padding: 48px 0 96px; }
.toc { position: sticky; top: 84px; font-size: 14px; }
.toc a { display: block; color: var(--muted); padding: 5px 0; }
.toc a:hover { color: var(--brand); text-decoration: none; }
.docs-body h2 { margin-top: 56px; padding-top: 8px; }
.docs-body h2:first-of-type { margin-top: 0; }
.docs-body h3 { margin-top: 28px; }
.endpoint {
  display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-mono);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 12px; font-size: 14px; margin: 6px 0; color: var(--ink);
}
.endpoint .method { font-weight: 600; color: var(--brand); }
table.ref { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 14px; }
table.ref th, table.ref td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.ref th { color: var(--muted); font-weight: 500; font-size: 13px; }

/* ── Dashboard ── */
.keybox {
  font-family: var(--font-mono); background: #F4F6F8; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; word-break: break-all; font-size: 13.5px;
  display: flex; align-items: center; gap: 12px;
}
.meter { height: 10px; background: var(--brand-wash); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin: 10px 0 6px; }
.meter .fill { height: 100%; background: var(--brand); }
.bars { display: grid; gap: 10px; margin-top: 16px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 64px; align-items: center; gap: 12px; font-size: 14px; }
.bar-row .bar { height: 8px; border-radius: 999px; min-width: 2px; }
.bar-row .val { text-align: right; font-family: var(--font-mono); font-size: 13px; color: var(--muted); }

/* ── Modal (ArcGIS item picker) ── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(21, 21, 21, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal { width: 100%; max-width: 560px; max-height: 80vh; display: flex; flex-direction: column; }
.agol-list { overflow-y: auto; border-top: 1px solid var(--border); }
.agol-item {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: none; border: none; border-bottom: 1px solid var(--border);
  padding: 12px 8px; font-family: var(--font-sans);
}
.agol-item:hover { background: var(--brand-wash); }
.agol-item b { display: block; font-weight: 600; font-size: 15px; color: var(--ink); }
.agol-item span { font-size: 13px; color: var(--muted); }

/* ── Footer ── */
footer { border-top: 1px solid var(--border); padding: 40px 0 48px; color: var(--muted); font-size: 14px; position: relative; overflow: hidden; background: var(--surface); }
footer .wrap { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; position: relative; }
footer nav { margin-left: auto; display: flex; gap: 20px; }
footer .contour { position: absolute; right: -40px; bottom: -60px; opacity: 0.08; pointer-events: none; }
footer .contour g { stroke: var(--brand); }

@media (max-width: 760px) {
  .hero { padding: 64px 0 48px; }
  .hero h1 { font-size: 38px; }
  .price-band { grid-template-columns: 1fr; gap: 36px; padding: 32px 24px; }
  .price-band .amount { font-size: 64px; }
  .price-points { grid-template-columns: 1fr; gap: 18px; }
  h1 { font-size: 30px; }
  h2 { font-size: 24px; }
  .section { padding: 64px 0; }
  .doors, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .docs-layout { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: 1fr 1fr; }
  .toc { position: static; }
  .stepper { flex-direction: column; }
  .stepper li { border-left: none; border-top: 1px solid var(--border); }
  .stepper li:first-child { border-top: none; }
  .nav nav a:not(.btn) { display: none; }
}
