/* Postcode Plus (web test). Mobile first; blue and Heebo carried over from the 2019 app. */

:root {
  --blue: #2c4df3;
  --blue-dark: #12299e;
  --bg: #f3f5fb;
  --card: #ffffff;
  --text: #16192b;
  --muted: #5d6480;
  --line: #dfe3f0;
  --ok: #117a43;
  --bad: #c0322b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 80, .06), 0 4px 16px rgba(20, 30, 80, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1220;
    --card: #1a1e33;
    --text: #eceefa;
    --muted: #a0a6c4;
    --line: #2d3352;
    --ok: #4ccf8a;
    --bad: #ff7a70;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 Heebo, system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--blue); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .5rem; font-weight: 800; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1000;
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-size: 1.15rem; }
.brand b { color: var(--blue); font-weight: 800; }
.badge { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 2px 8px; }

.page { max-width: 560px; margin: 0 auto; padding: 16px 16px 24px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin: 0 0 16px; }
.center { text-align: center; }
.muted { color: var(--muted); margin: 0 0 .75rem; }
.label { font-size: .8rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--blue); color: #fff; font-size: .75rem; letter-spacing: 0; }

.intro { padding: 12px 2px 20px; }
.intro p { color: var(--muted); margin: 0; }
.screen-title { margin: 4px 2px 16px; }
.step { margin-bottom: 22px; }

.foot { text-align: center; font-size: .75rem; color: var(--muted); padding: 8px 16px calc(24px + env(safe-area-inset-bottom)); }
.foot a { color: inherit; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:active { background: var(--blue-dark); }
.btn.danger { color: var(--bad); border-color: transparent; background: transparent; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.block { display: flex; width: 100%; margin-bottom: 10px; }
.btn.big { min-height: 56px; font-size: 1.1rem; margin-bottom: 16px; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: .85rem; border-radius: 9px; }
.btn.back { padding: 0 8px; margin: -8px 0 4px -8px; }
.btn-row { display: flex; gap: 8px; margin-bottom: 8px; }
.btn-row .btn { flex: 1; padding: 0 8px; }

.chip {
  border: 0; border-radius: 99px; padding: 8px 14px; min-height: 36px;
  background: var(--card); color: var(--text); font: inherit; font-size: .9rem; font-weight: 500;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25); cursor: pointer;
}
/* Drawn icons, not emoji: emoji look different on every phone (and the iPhone simulator can't draw them). */
.ico { width: 1.15em; height: 1.15em; fill: currentColor; vertical-align: -.2em; }
#locate-btn .ico { margin-right: 6px; color: var(--blue); }
#suggest-btn .ico { color: var(--blue); }

label { display: block; font-weight: 500; margin-bottom: 14px; }
.opt { font-weight: 400; color: var(--muted); font-size: .85rem; }
input, textarea {
  display: block; width: 100%; margin-top: 6px;
  font: inherit; font-size: 16px; /* 16px stops iOS zooming into the field */
  color: var(--text); background: var(--bg);
  border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 12px;
}
input:focus, textarea:focus { outline: none; border-color: var(--blue); }
input, textarea, .step { scroll-margin-top: 72px; } /* clear the sticky header */
input:disabled { opacity: .7; }
input[readonly] { background: var(--bg); } /* the area code: set by the pin, not typed */
textarea { resize: vertical; min-height: 96px; }
.code-input { text-transform: uppercase; font-weight: 700; letter-spacing: .04em; }
.code-input::placeholder { text-transform: none; font-weight: 400; letter-spacing: 0; }

.input-row { display: flex; gap: 8px; }
.input-row input { margin: 0; }
.find .label { margin-bottom: 10px; }

.code-builder { display: grid; grid-template-columns: 1fr 88px auto; gap: 8px; align-items: end; }
.code-builder label { margin: 0; font-size: .85rem; color: var(--muted); }
.code-builder .chip { margin-bottom: 4px; }

.hint { font-size: .9rem; color: var(--muted); margin: 8px 2px 0; }
.hint.first { margin: 0 2px 12px; }
.hint.warn { color: var(--text); background: color-mix(in srgb, #f5a623 18%, transparent); padding: 8px 10px; border-radius: 8px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: .92rem; color: var(--muted); }
label.check b { color: var(--text); font-weight: 500; }
label.check input { width: 22px; height: 22px; flex: none; margin: 1px 0 0; accent-color: var(--blue); }
.hint.ok { color: var(--ok); font-weight: 500; }
.hint.bad { color: var(--bad); font-weight: 500; }
.form-error { color: var(--bad); font-weight: 500; background: color-mix(in srgb, var(--bad) 10%, transparent); padding: 10px 12px; border-radius: 10px; }

/* ---------- photo ---------- */
.photo-field { margin-bottom: 14px; font-weight: 500; }
.photo-field > span { display: block; margin-bottom: 6px; }
.photo-field .btn { margin: 0; }
.photo-preview { position: relative; margin-bottom: 8px; }
.photo-preview img { display: block; width: 100%; max-height: 260px; object-fit: cover; border-radius: 10px; }
.photo-preview .chip { position: absolute; top: 8px; right: 8px; }

/* ---------- maps ---------- */
.map { border-radius: var(--radius); overflow: hidden; background: var(--line); z-index: 0; }
.map-wrap { position: relative; }
.map-pick { height: 56vh; min-height: 300px; max-height: 520px; }
.map-view { height: 260px; margin-bottom: 16px; position: relative; }
.map-tools { position: absolute; left: 10px; right: 10px; bottom: 26px; /* clear of the map credit line */ display: flex; justify-content: space-between; z-index: 500; pointer-events: none; }
.map-tools .chip, .map-layer { pointer-events: auto; }
.map-layer { position: absolute; right: 10px; bottom: 22px; z-index: 500; }

/* The pin stays fixed in the middle; the map moves under it. Easier than dragging on a phone. */
.crosshair, .pin-icon span {
  width: 34px; height: 44px;
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 34 44'%3E%3Cpath d='M17 43S3 26.6 3 16.5a14 14 0 1 1 28 0C31 26.6 17 43 17 43z' fill='%232c4df3' stroke='%23fff' stroke-width='2.5'/%3E%3Ccircle cx='17' cy='16.5' r='5.5' fill='%23fff'/%3E%3C/svg%3E");
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35));
}
.crosshair { position: absolute; left: 50%; top: 50%; margin: -42px 0 0 -17px; z-index: 450; pointer-events: none; }
.pin-icon { background: none; border: 0; }
.pin-icon span { display: block; }

/* ---------- shared-code page ---------- */
/* Whole photo, never cropped: portrait phone shots of a gate or door were losing most of the picture. */
.hero-photo { margin: 0 0 16px; }
.hero-photo .photo-open { display: block; width: 100%; padding: 0; border: 0; cursor: zoom-in; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.hero-photo img { display: block; width: 100%; max-height: 60vh; object-fit: contain; }
.lightbox { position: fixed; inset: 0; z-index: 3000; background: rgba(0, 0, 0, .92); display: flex; align-items: center; justify-content: center; cursor: zoom-out; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox .chip { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; }
.code-big {
  display: block; margin: 0 0 6px; padding: 0; border: 0; background: none; cursor: pointer;
  font: 800 2rem/1.1 Heebo, system-ui, sans-serif; letter-spacing: .03em; color: var(--blue);
}
.center .code-big { margin: 4px auto 10px; }
.code-place { margin: -2px 0 6px; }
.place { font-size: 1.25rem; margin: 6px 0 2px; }
.directions-text { margin: 0; font-size: 1.05rem; white-space: normal; }
#v-description { white-space: pre-line; } /* the app fills it as text; the website uses <br> */
.card .label:not(:first-child) { margin-top: 16px; }
.btn-row .btn { white-space: nowrap; }
.btn-row.three .btn { font-size: .85rem; padding: 0 4px; }
#copy-coords { font-size: .85rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.owner-bar { background: color-mix(in srgb, var(--blue) 12%, var(--card)); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; font-weight: 500; }
.owner-row { display: flex; align-items: center; justify-content: space-between; }
.owner-private { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.owner-private p { margin: 0 0 8px; font-weight: 400; font-size: .92rem; color: var(--muted); }

/* Second photo: parcel spot, key safe... */
.card.detail .photo-open { display: block; width: 100%; padding: 0; border: 0; cursor: zoom-in; background: var(--bg); border-radius: 10px; overflow: hidden; }
.card.detail img { display: block; width: 100%; max-height: 60vh; object-fit: contain; }
.report-line { text-align: center; font-size: .9rem; margin: 0 0 16px; }
.report-line a { color: var(--muted); }
.cta { text-align: center; padding: 18px 8px; color: var(--muted); }
.cta p { margin: 0 0 12px; }

/* ---------- lists, done screen, toast ---------- */
.code-list { list-style: none; margin: 0; padding: 0; }
.code-list li { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); }
.code-list li:first-child { border-top: 0; }
.code-list a:first-child { font-weight: 800; letter-spacing: .03em; text-decoration: none; font-size: 1.1rem; }
.link-line { word-break: break-all; font-size: .9rem; color: var(--muted); margin: 0 0 16px; }
.note p { margin: 0 0 12px; color: var(--muted); font-size: .95rem; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 2000;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.leaflet-container { font: inherit; }
