/* Styled to match www.taupodc.govt.nz:
   Prompt (headings) + Open Sans (body), navy #231F58, teal #009FB6,
   orange #F26631, body text #555, light grey panels. */
:root {
  --navy: #231f58;
  --navy-soft: #ecebf3;
  --teal: #009fb6;
  --teal-dark: #007a8c;   /* teal darkened for small text on white (WCAG AA) */
  --orange: #f26631;
  --text: #555555;
  --text-strong: #2e2e2e;
  --muted: #6b6b6b;
  --border: #dedede;
  --panel: #f5f5f5;
  --surface: #ffffff;
  --footer-bg: #343d46;
  --focus: #ffbf47;
  --good-bg: #e6f4e9;  --good-fg: #1e7a36;
  --info-bg: #e0f3f6;  --info-fg: #006373;
  --warn-bg: #fdf0d8;  --warn-fg: #7a4a00;
  --bad-bg:  #fbe4e4;  --bad-fg:  #b0151a;
  --neutral-bg: #eeeeee; --neutral-fg: #4a4a4a;
  --radius: 4px;
  --font-body: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-head: "Prompt", "Open Sans", system-ui, sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }

/* Always reserve room for the vertical scrollbar so the layout doesn't
   shift sideways when the page grows or shrinks (e.g. selecting a property). */
html { scrollbar-gutter: stable; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
}

h1, h2, h3 { font-family: var(--font-head); font-weight: 600; color: var(--navy); }

a { color: var(--teal-dark); }
a:hover { color: var(--navy); }

.wrap { max-width: 1400px; margin: 0 auto; padding: 0 30px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 16px; top: 8px; background: var(--focus); color: #000; padding: 8px 12px; z-index: 100; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------------------------------------------------------- site header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 110px; }
/* Same header width as www.taupodc.govt.nz (1440px), and CONTACT sits where it does
   there: 76px in from the right, the space their search icon occupies */
.site-header__inner { max-width: 1440px; }
.site-header__links { margin-right: 76px; }
.site-logo { display: block; line-height: 0; }
.site-logo img { height: 66px; width: auto; display: block; }
/* Matches the CONTACT link on www.taupodc.govt.nz as visitors actually see it: that
   site asks for Open Sans but never loads it, so browsers show Arial (Windows) or
   Helvetica (Mac). 16px bold #555, uppercase, no colour change on hover. */
.site-header__links a {
  color: var(--text); text-decoration: none; text-transform: uppercase;
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  font-weight: 700; font-size: 1rem; line-height: 24px;
}

@media (max-width: 640px) {
  .site-header__inner { min-height: 76px; }
  .site-logo img { height: 46px; }
  .site-header__links { display: none; }
}

/* ---------------------------------------------------------- beta notice */
.beta-banner { background: var(--warn-bg); color: var(--warn-fg); border-bottom: 3px solid #e0a020; }
.beta-banner .wrap { display: flex; gap: 12px; align-items: flex-start; padding-top: 12px; padding-bottom: 12px; }
.beta-banner p { margin: 0; max-width: 90ch; flex: 1; }
.beta-banner[hidden] { display: none; }
.beta-close {
  flex: none; margin: -6px -8px 0 auto;
  width: 36px; height: 36px; padding: 0;
  font-size: 1.75rem; line-height: 1; color: var(--warn-fg);
  background: transparent; border: 0; border-radius: 50%; cursor: pointer;
}
.beta-close:hover { background: rgba(122, 74, 0, .12); }
.beta-tag {
  flex: none; background: #7a4a00; color: #fff; font-weight: 700; font-size: .8125rem;
  text-transform: uppercase; letter-spacing: .05em; padding: 2px 10px; border-radius: 999px; margin-top: 2px;
}

/* ---------------------------------------------------------- page intro */
.page-intro { padding-top: 32px; padding-bottom: 28px; }
.breadcrumb ol { list-style: none; margin: 0 0 28px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 0; font-size: .875rem; }
.breadcrumb li { display: flex; align-items: center; }
.breadcrumb li + li::before {
  content: ""; width: 7px; height: 7px; margin: 0 14px 0 12px;
  border-top: 1.5px solid var(--text); border-right: 1.5px solid var(--text); transform: rotate(45deg);
}
.breadcrumb a { color: var(--text); text-decoration: none; }
.breadcrumb a:hover { color: var(--teal-dark); text-decoration: underline; }
.breadcrumb [aria-current] { color: var(--muted); }

.page-intro h1 { font-size: 3rem; line-height: 1.05; margin: 0 0 16px; max-width: 22ch; }
.page-intro .lede { margin: 0; max-width: 54rem; font-size: 1.0625rem; text-wrap: pretty; }   /* two lines on desktop, no lone last word */
.page-intro .lede + .lede { margin-top: 12px; }   /* disclaimer under the intro, same font, size and colour */

@media (max-width: 640px) {
  .page-intro { padding-top: 20px; padding-bottom: 20px; }
  .breadcrumb ol { margin-bottom: 16px; }
  .page-intro h1 { font-size: 2rem; }
}

/* ---------------------------------------------------------- layout */
.layout {
  display: grid;
  grid-template-columns: minmax(300px, 400px) 1fr;
  gap: 30px;
  align-items: start;
  padding-bottom: 48px;
}
.panel { border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.search-panel {
  background: var(--panel);
  padding: 20px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
}
/* clip (not hidden) so sticky content inside still sticks to the page */
.detail-panel { background: var(--surface); overflow: hidden; overflow: clip; }

/* Desktop: always tall enough to scroll the search panel and map to the top of
   the screen (after selecting a property, or resetting with Home / ×) */
@media (min-width: 861px) {
  .layout { min-height: calc(100vh - 16px); }
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: 20px; }
  .search-panel { position: static; max-height: none; }
  .results-list { max-height: 50vh; }
}

/* ---------------------------------------------------------- search */
.field-label { display: block; font-weight: 700; color: var(--text-strong); margin-bottom: 8px; }
.search-box { position: relative; }
.search-box input {
  width: 100%;
  font: inherit; font-size: 1.125rem; color: var(--text-strong);
  padding: 12px 44px 12px 16px;
  border: 1px solid #bdbdbd;
  border-radius: 0;
  background: #fff;
}
.search-box input::placeholder { color: #8a8a8a; font-size: 1rem; }
.search-box input:focus { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--navy); }
.search-box input::-webkit-search-cancel-button { display: none; }
@media (max-width: 640px) {
  .search-panel { padding: 16px; }
  .search-box input { padding-left: 12px; padding-right: 40px; }
  .search-box input::placeholder { font-size: .875rem; }
  .search-icon { right: 12px; }
}
@media (max-width: 380px) {
  .search-box input::placeholder { font-size: .8125rem; }
}
.search-icon {
  position: absolute; right: 14px; top: 50%; width: 22px; height: 22px; transform: translateY(-50%);
  fill: var(--orange); pointer-events: none;
}
.search-box:has(.clear-btn:not([hidden])) .search-icon { display: none; }
.clear-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; font-size: 1.6rem; line-height: 1; padding: 4px 10px; cursor: pointer; color: var(--orange);
}
.hint {
  font-size: .875rem; color: var(--muted); margin: 8px 0 14px;
  max-height: 8em; overflow: hidden;            /* room for the hint at any width */
  transition: max-height .3s ease, opacity .2s ease, margin .3s ease;
}
/* Hidden while there are results to show; back when the list is empty */
.hint.is-collapsed { max-height: 0; opacity: 0; margin-top: 0; margin-bottom: 4px; }
@media (prefers-reduced-motion: reduce) { .hint { transition: none; } }

.results-status { font-size: .875rem; color: var(--muted); min-height: 1.5em; margin-bottom: 8px; }
/* In the fixed-height desktop panel only the results list may shrink (and scroll);
   the search box, hint and status line always keep their full height */
.search-panel > :not(.results-list) { flex-shrink: 0; }
.results-status.error { color: var(--bad-fg); }

.results-list {
  list-style: none; margin: 0; padding: 0;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  background: #fff;
  border: 1px solid var(--border);
}
.results-list:empty { display: none; }
.results-list li + li { border-top: 1px solid var(--border); }
.result-btn {
  display: block; width: 100%; text-align: left;
  font: inherit; color: inherit; background: transparent; border: 0;
  padding: 12px 14px 12px 12px;
  border-left: 4px solid transparent;
  cursor: pointer;
}
.result-btn:hover { background: #f0fafc; }
.result-btn[aria-current="true"] { background: #e6f6f8; border-left-color: var(--teal); }
/* Consents with no linked property: same card, address in muted italics */
.result-btn.is-unlinked .result-address > span:first-child { color: var(--muted); font-style: italic; font-weight: 600; }
.result-address { font-weight: 700; color: var(--navy); display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.result-meta { font-size: .8125rem; color: var(--muted); display: block; }
/* Legal description: one line, truncated with … (full text in the tooltip) */
.result-legal { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Consent that matched the search, for properties found through their consents */
.result-consent {
  display: block; font-size: .75rem; color: var(--muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.result-consent .more { color: var(--text-strong); font-weight: 600; }
.result-meta .val { font-variant-numeric: tabular-nums; color: var(--text-strong); font-weight: 600; }
.badge-count {
  flex: none;
  font-size: .75rem; font-weight: 700;
  background: var(--navy); color: #fff;
  padding: 1px 9px; border-radius: 999px; white-space: nowrap;
}
.badge-count.zero { background: var(--neutral-bg); color: var(--neutral-fg); font-weight: 600; }
mark { background: #fff0b3; color: inherit; padding: 0; }

/* ---------------------------------------------------------- detail */
.map { height: 360px; border-bottom: 1px solid var(--border); }

/* Home button on the map – sized and coloured like the SDK's zoom buttons */
.map-home-btn {
  width: 32px; height: 32px; padding: 0; margin: 0;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 0; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color: #6e6e6e;
}
.map-home-btn:hover { background: #f3f3f3; color: #151515; }
.map-home-btn svg { width: 16px; height: 16px; fill: currentColor; }
.detail { padding: 24px 28px 28px; }
.empty-state h2 { margin: 0 0 8px; font-size: 1.75rem; }
.empty-state p { margin: 0; }

.property-summary h2 { margin: 0 0 12px; font-size: 2.25rem; line-height: 1.2; }
.property-sites { margin: -6px 0 14px; font-size: .875rem; color: var(--muted); }
.property-sites .label { font-weight: 600; }
.property-sites .site:not(:last-child)::after,
.property-sites .sites:has(+ .sites-more:not([hidden])) .site:last-child::after { content: " · "; color: #aaa; }
.property-sites .sites-more:not([hidden]) { display: inline; }
.link-btn {
  font: inherit; font-weight: 600; color: var(--teal-dark); background: none; border: 0;
  padding: 0 0 0 6px; cursor: pointer; text-decoration: underline;
}

/* Consent highlighted because it matched the search */
.match-tag {
  display: inline-block; margin-top: 4px; font-size: .6875rem; font-weight: 700; text-transform: uppercase; white-space: nowrap;
  letter-spacing: .03em; color: #8a3b12; background: #fde3d6; border-radius: 999px; padding: 1px 8px;
}
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px 28px;
  margin: 0 0 20px;
  padding: 14px 18px;
  background: var(--panel);
  border: 1px solid var(--border);
}
.facts div { min-width: 0; }
.facts div:only-child { grid-column: 1 / -1; }   /* a single fact (e.g. no linked property) uses the full width */
.facts dt { font-size: .8125rem; color: var(--muted); }
.facts dd { margin: 0; color: var(--text-strong); font-weight: 600; overflow-wrap: anywhere; }

.consents-status { margin: 8px 0; }
.consents-status.error { color: var(--bad-fg); }
#detail-content .tabs, #detail-content .tab-panel { transition: opacity .15s; }
#detail-content.is-loading .tabs, #detail-content.is-loading .tab-panel { opacity: .45; pointer-events: none; }

/* Tabs – pill buttons like the council site's quick links */
.tabs { display: flex; gap: 10px; margin: 16px 0 4px; flex-wrap: wrap; }
.tabs [role="tab"] {
  font: inherit; font-weight: 700; font-size: .9375rem; text-transform: uppercase;
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 20px;
  cursor: pointer;
}
.tabs [role="tab"]:hover { border-color: var(--navy); }
.tabs [role="tab"][aria-selected="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.tabs .count {
  display: inline-block; min-width: 1.7em; text-align: center;
  background: var(--navy-soft); color: var(--navy);
  border-radius: 999px; font-size: .8125rem; padding: 0 7px; margin-left: 6px;
}
.tabs [aria-selected="true"] .count { background: #fff; color: var(--navy); }
.tab-panel { padding-top: 16px; }
.tab-panel:focus-visible { outline-offset: 4px; }

/* Desktop: the property block (address -> tabs) stays at the top of the screen
   while scrolling through the consents, then scrolls away at the end of the list.
   Not on narrow or short screens. */
@media (min-width: 861px) and (min-height: 600px) {
  .detail-sticky {
    position: sticky; top: 0; z-index: 3;
    background: var(--surface);
    padding-top: 12px; margin-top: -12px;     /* a little breathing room above the address when stuck */
  }
  .detail-sticky .tabs { margin-bottom: 0; padding-bottom: 16px; }
  #detail-content .tab-panel { padding-top: 0; }
  /* a highlighted consent stops just below the sticky block */
  .consent-cards .consent-card { scroll-margin-top: calc(var(--sticky-h, 0px) + 16px); }
}
/* Smaller tab buttons where the consents area is narrow (tablets, small windows, phones) */
@media (max-width: 1100px) {
  .tabs [role="tab"] { padding: 8px 14px; font-size: .875rem; }
}

.status {
  display: inline-block; font-size: .8125rem; font-weight: 700;
  padding: 2px 10px; border-radius: 999px; white-space: nowrap;
  background: var(--neutral-bg); color: var(--neutral-fg);
}
.status.good { background: var(--good-bg); color: var(--good-fg); }
.status.info { background: var(--info-bg); color: var(--info-fg); }
.status.warn { background: var(--warn-bg); color: var(--warn-fg); }
.status.bad  { background: var(--bad-bg);  color: var(--bad-fg); }

.none { color: var(--muted); padding: 8px 0; margin: 0; }

/* Consent cards - every screen size. Same font size throughout. On wider cards
   the details sit on the left and the status and dates on the right. */
.consent-cards { list-style: none; margin: 0; padding: 0; container-type: inline-size; }
.consent-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 12px;
  font-size: .9375rem; line-height: 1.45; color: var(--text-strong);
  scroll-margin-top: 16px;
  overflow-wrap: anywhere;
}
.consent-card p { margin: 0 0 4px; }
.consent-card .cc-main > p:last-child, .consent-card .cc-side > p:last-child { margin-bottom: 0; }
.consent-card .cc-main { margin-bottom: 4px; }
.consent-card .cc-title { color: var(--navy); font-weight: 700; }
.consent-card .cc-k { font-weight: 600; color: var(--text-strong); }
.consent-card .cc-desc { margin: 6px 0; }
.consent-card .cc-dim { color: var(--muted); }
.consent-card .cc-pills .status { margin-right: 4px; vertical-align: 1px; }
.consent-card.is-match { background: #fff8d6; box-shadow: inset 4px 0 0 var(--orange); }
@container (min-width: 620px) {
  .consent-card { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 0 24px; }
  .consent-card .cc-main { margin-bottom: 0; }
  .consent-card .cc-side { border-left: 1px solid var(--border); padding-left: 18px; }
}

/* Phone */
@media (max-width: 640px) {
  .map { height: 260px; }
  .detail { padding: 18px 16px 20px; }
  .property-summary h2 { font-size: 1.625rem; }
}

/* ---------------------------------------------------------- footer */
.site-footer { background: var(--footer-bg); color: #fff; }
.site-footer__inner {
  display: flex; justify-content: space-between; align-items: center; gap: 24px 40px; flex-wrap: wrap;
  padding-top: 48px; padding-bottom: 48px;
}
.site-footer__text { max-width: 70ch; font-size: .9375rem; }   /* wide enough for the disclaimer in 4 lines */
.site-footer__text p { margin: 0 0 12px; }
/* Links in the footer (e.g. the LIM link in the disclaimer): white and underlined on the dark background */
.site-footer__text a { color: #fff; text-decoration: underline; }
.site-footer__text a:hover { color: #fff; text-decoration-thickness: 2px; }
.site-footer__copy { text-transform: uppercase; font-size: .875rem; margin-bottom: 0 !important; }
.site-footer__logo { line-height: 0; }
.site-footer__logo img { height: 85px; width: auto; display: block; }
@media (max-width: 640px) {
  .site-footer__inner { padding-top: 32px; padding-bottom: 32px; }
  .site-footer__logo img { height: 60px; }
}

@media print {
  .search-panel, .map, .tabs, .site-footer, .skip-link, .breadcrumb { display: none !important; }
  .layout { display: block; }
  .tab-panel[hidden] { display: block !important; }
  .panel { border: 0; }
}
