/*
 * pages.css — the reading pages: the zoning, ward and GIS-data pages that
 * tools/build_seo_pages.js writes, and the land-search guide.
 *
 * They are what a search engine sends people to, so they are built to open
 * fast: no DaisyUI, no Tailwind runtime, no web fonts — this file and
 * theme.css (the brand's colour variables, loaded first) and nothing else
 * render-blocking. Colours come from theme.css's variables, so light and dark
 * follow the rest of the site.
 */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: oklch(var(--b2));
  color: oklch(var(--bc));
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

a { color: #1f7a1f; }
[data-theme='dark'] a { color: #6ee7b7; }

/* ── Header ───────────────────────────────────────────────────────────── */
.pg-head {
  background: #1a3c34;
  color: #fff;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.pg-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  font-size: 1.02rem;
}
.pg-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 4px;
}
.pg-nav a,
.pg-nav button {
  color: #fff;
  text-decoration: none;
  font: inherit;
  font-size: 0.9rem;
  padding: 6px 9px;
  border-radius: 8px;
  background: none;
  border: 0;
  cursor: pointer;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}
.pg-nav a:hover,
.pg-nav button:hover { background: rgba(255, 255, 255, 0.12); }
.pg-nav a[aria-current='page'] { background: rgba(255, 255, 255, 0.16); font-weight: 700; }
.pg-nav .pg-cta {
  background: #22c55e;
  color: #052e16;
  font-weight: 800;
}
.pg-nav .pg-cta:hover { background: #4ade80; }

/* ── Page ─────────────────────────────────────────────────────────────── */
.pg {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 18px 18px 56px;
  flex: 1 0 auto;
}
.pg-crumbs {
  font-size: 0.85rem;
  opacity: 0.75;
  margin: 4px 0 10px;
}
.pg-crumbs a { color: inherit; }
.pg-crumbs span[aria-hidden] { margin: 0 6px; }
.pg h1 {
  font-size: clamp(1.65rem, 4.4vw, 2.45rem);
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 6px 0 10px;
  color: #1a3c34;
  max-width: 26ch;
}
[data-theme='dark'] .pg h1 { color: #6ee7b7; }
.pg-lead {
  font-size: 1.08rem;
  max-width: 68ch;
  margin: 0 0 14px;
}
.pg-kicker {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: oklch(var(--p));
}
.pg-updated { font-size: 0.82rem; opacity: 0.65; margin: 0 0 18px; }
.pg h2 {
  font-size: 1.34rem;
  font-weight: 800;
  line-height: 1.25;
  margin: 36px 0 10px;
  color: #1a3c34;
}
[data-theme='dark'] .pg h2 { color: #6ee7b7; }
.pg h3 { font-size: 1.05rem; font-weight: 800; margin: 18px 0 6px; }
.pg p { margin: 0 0 12px; max-width: 72ch; }
.pg ul, .pg ol { max-width: 72ch; padding-left: 1.25em; margin: 0 0 12px; }
.pg li { margin: 4px 0; }

.pg-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 8px; }
.pg-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 800;
  text-decoration: none;
  background: #228b22;
  color: #fff !important;
  border: 1px solid transparent;
}
.pg-btn:hover { background: #1a6f1a; }
.pg-btn.alt {
  background: transparent;
  color: #1a3c34 !important;
  border-color: rgba(26, 60, 52, 0.35);
}
[data-theme='dark'] .pg-btn.alt { color: #e5e7eb !important; border-color: rgba(229, 231, 235, 0.3); }

/* Figure tiles: the numbers a reader came for. */
.pg-figs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
  gap: 12px;
  margin: 18px 0 8px;
}
.pg-fig {
  background: oklch(var(--b1));
  border: 1px solid oklch(var(--b3));
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 4px 18px -10px rgba(15, 23, 42, 0.22);
}
.pg-fig b {
  display: block;
  font-size: 1.7rem;
  font-weight: 900;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: oklch(var(--p));
}
.pg-fig span { display: block; font-size: 0.88rem; opacity: 0.8; line-height: 1.4; }
.pg-fig small { display: block; font-size: 0.78rem; opacity: 0.65; margin-top: 4px; }

.pg-card {
  background: oklch(var(--b1));
  border: 1px solid oklch(var(--b3));
  border-radius: 16px;
  padding: 16px 18px;
  margin: 12px 0;
  box-shadow: 0 4px 18px -10px rgba(15, 23, 42, 0.18);
}
.pg-quote {
  border-left: 4px solid #22c55e;
  background: oklch(var(--b1));
  border-radius: 0 14px 14px 0;
  padding: 12px 16px;
  margin: 12px 0;
  max-width: 72ch;
}
.pg-quote p:last-child { margin-bottom: 0; }
.pg-note {
  font-size: 0.9rem;
  opacity: 0.78;
  max-width: 72ch;
}
.pg-alert {
  border: 1px solid oklch(var(--wa) / 0.55);
  background: oklch(var(--wa) / 0.12);
  border-radius: 14px;
  padding: 12px 16px;
  margin: 12px 0;
  max-width: 72ch;
}

/* Tables scroll inside their own box on a phone, never the page. */
.pg-tablewrap {
  overflow-x: auto;
  background: oklch(var(--b1));
  border: 1px solid oklch(var(--b3));
  border-radius: 14px;
  margin: 12px 0;
}
.pg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}
.pg-table th,
.pg-table td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid oklch(var(--b3));
  vertical-align: top;
}
.pg-table thead th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.75;
  white-space: nowrap;
}
.pg-table td.n,
.pg-table th.n { text-align: right; white-space: nowrap; }
.pg-table tr:last-child td { border-bottom: 0; }
.pg-table caption { text-align: left; padding: 10px 12px 0; font-size: 0.85rem; opacity: 0.75; }

/* Lists of links: wards, zones, datasets. */
.pg-links {
  list-style: none;
  padding: 0 !important;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr));
  gap: 8px;
  max-width: none !important;
}
.pg-links li { margin: 0; }
.pg-links a {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  background: oklch(var(--b1));
  border: 1px solid oklch(var(--b3));
  text-decoration: none;
  color: inherit;
  min-height: 44px;
}
.pg-links a:hover { border-color: #22c55e; }
.pg-links b { display: block; color: #1f7a1f; }
[data-theme='dark'] .pg-links b { color: #6ee7b7; }
.pg-links small { display: block; opacity: 0.72; font-size: 0.82rem; line-height: 1.4; }

.pg-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; padding: 0; list-style: none; }
.pg-chips li { margin: 0; }
.pg-chips a,
.pg-chips span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 12px;
  border-radius: 999px;
  background: oklch(var(--b1));
  border: 1px solid oklch(var(--b3));
  font-size: 0.88rem;
  text-decoration: none;
  color: inherit;
}

/* FAQ: <details> a reader can open; the same answers are the JSON-LD. */
.pg-faq details {
  background: oklch(var(--b1));
  border: 1px solid oklch(var(--b3));
  border-radius: 14px;
  margin: 8px 0;
  max-width: 76ch;
}
.pg-faq summary {
  cursor: pointer;
  padding: 12px 16px;
  font-weight: 700;
  min-height: 44px;
}
.pg-faq details > div { padding: 0 16px 12px; }

/* ── Footer ───────────────────────────────────────────────────────────── */
.pg-foot {
  background: #1a3c34;
  color: #c8e6d0;
  padding: 26px 18px 30px;
  font-size: 0.9rem;
}
.pg-foot-in {
  max-width: 1040px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 18px;
}
.pg-foot h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 8px;
  color: #fff;
}
.pg-foot ul { list-style: none; padding: 0; margin: 0; }
.pg-foot li { margin: 2px 0; }
.pg-foot a {
  color: #bbf7d0;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
}
.pg-foot a:hover { text-decoration: underline; }
.pg-foot-copy { max-width: 1040px; margin: 18px auto 0; font-size: 0.8rem; opacity: 0.75; }

@media (max-width: 640px) {
  .pg { padding: 12px 14px 44px; }
  /* Its links wrap to two or three rows on a phone; held at the top it would
     cover a fifth of the screen all the way down the page. */
  .pg-head { padding: 8px 12px; position: static; }
  .pg-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pg-fig { padding: 12px 13px; }
  .pg-fig b { font-size: 1.35rem; }
  .pg-nav a, .pg-nav button { font-size: 0.86rem; padding: 6px 7px; }
}
@media print {
  .pg-head, .pg-foot, .pg-actions { display: none; }
  body { background: #fff; color: #000; }
}

/* ── Ward maps (ward_maps_page.js) ─────────────────────────────────────
   A ward's maps listed live from ward_maps_api.php: each file with View and
   Download once bought (or a lock), and what the reader can do about the
   ward — buy, sign in, ask us to find one. The same block is a card per
   ward on the hub, and a badge on each ward that has maps. */
button.pg-btn { font: inherit; font-weight: 800; cursor: pointer; }
button.pg-btn:disabled { opacity: 0.6; cursor: progress; }
.pg-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pg-wm, .pg-wm-hub { max-width: 72ch; }
.pg-wm-head { margin: 0 0 10px; }
/* .pg ul (class + element) would indent it: the same weight plus one. */
.pg .pg-wm-files { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; max-width: none; }
.pg-wm-file {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 10px 12px;
  background: oklch(var(--b1));
  border: 1px solid oklch(var(--b3));
  border-radius: 12px;
}
.pg-wm-ico { font-size: 1.3rem; line-height: 1; flex: 0 0 auto; }
.pg-wm-name { flex: 1 1 auto; min-width: 0; }
.pg-wm-name b { display: block; overflow-wrap: anywhere; }
.pg-wm-name small { display: block; opacity: 0.7; font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.pg-wm-act { display: flex; flex-wrap: wrap; gap: 6px; flex: 0 0 auto; justify-content: flex-end; }
.pg-wm-btn {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 9px;
  border: 1px solid rgba(26, 60, 52, 0.3);
  color: #1a3c34 !important;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
}
.pg-wm-btn:hover { border-color: #22c55e; }
.pg-wm-btn.pg-wm-dl { background: #228b22; border-color: #228b22; color: #fff !important; }
.pg-wm-btn.pg-wm-dl:hover { background: #1a6f1a; }
.pg-wm-lock { font-size: 0.86rem; font-weight: 700; opacity: 0.7; white-space: nowrap; }
.pg-wm-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 4px 0 10px; }
.pg-wm-hint { font-size: 0.9rem; opacity: 0.8; margin: 0; }
.pg-wm-msg {
  border-left: 4px solid #22c55e;
  background: oklch(var(--b1));
  border-radius: 0 12px 12px 0;
  padding: 10px 14px;
  margin: 8px 0 10px;
}
.pg-wm-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e7f3ea;
  color: #14532d;
  font-size: 0.76rem;
  font-weight: 700;
}
.pg-wm-hubgrid { display: grid; gap: 14px; margin: 6px 0 8px; }
.pg-wm-card {
  background: oklch(var(--b1));
  border: 1px solid oklch(var(--b3));
  border-radius: 16px;
  padding: 14px 16px 6px;
}
.pg-wm-card h3 { margin: 0 0 10px; }
.pg-wm-card .pg-wm-file { background: oklch(var(--b2)); }
[data-theme='dark'] .pg-wm-btn { color: #e5e7eb !important; border-color: rgba(229, 231, 235, 0.3); }
[data-theme='dark'] .pg-wm-btn.pg-wm-dl { color: #fff !important; border-color: #228b22; }
[data-theme='dark'] .pg-wm-badge { background: rgba(74, 222, 128, 0.16); color: #bbf7d0; }
@media (max-width: 640px) {
  .pg-wm-file { flex-wrap: wrap; }
  .pg-wm-act { width: 100%; justify-content: flex-start; padding-left: calc(1.3rem + 12px); }
}
@media print {
  .pg-wm-act, .pg-wm-cta { display: none; }
}
