:root {
  --ink: #1a2418;
  --muted: #5c6b57;
  --paper: #f3efe6;
  --panel: #f7f3eb;
  --line: #c9c2b4;
  --accent: #1f4d3a;
  --accent-2: #b86a1c;
  --shadow: 0 16px 40px rgba(26, 36, 24, 0.12);
  font-family: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Palatino, serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
}

body {
  overflow: auto;
}

a {
  color: var(--accent);
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.4rem;
  padding-top: max(0.85rem, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f7f3eb 0%, #ebe4d6 100%);
  position: sticky;
  top: 0;
  z-index: 5;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.85rem 1.1rem;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.92rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--ink);
}

.nav-cta {
  text-decoration: none !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.7rem;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--accent);
  font: inherit;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
}

.btn.primary {
  background: var(--accent);
  color: #f7f3eb;
}

.btn.ghost {
  background: transparent;
  color: var(--accent);
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2.5rem;
  max-width: 1080px;
  margin: 0 auto;
  padding: 3.2rem 1.4rem 2.4rem;
  align-items: center;
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--accent-2);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 0.85rem;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.15;
}

h2 {
  margin: 0 0 0.85rem;
  font-size: 1.7rem;
}

h3 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
}

.lede {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.5;
  max-width: 38rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.fine {
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.84rem;
}

.hero-panel {
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(243, 239, 230, 0.3), rgba(243, 239, 230, 0.72)),
    repeating-linear-gradient(90deg, #d7e3d4 0 18px, #c9d7c4 18px 19px),
    repeating-linear-gradient(0deg, #d7e3d4 0 18px, #c9d7c4 18px 19px);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero-map {
  position: absolute;
  inset: 1.2rem;
  display: grid;
  gap: 0.7rem;
  align-content: center;
}

.lot {
  display: inline-block;
  width: fit-content;
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  background: rgba(247, 243, 235, 0.94);
  border: 1px solid var(--line);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.88rem;
  font-weight: 650;
}

.lot.pass {
  border-color: var(--accent);
  color: var(--accent);
}

.lot.fail {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.lot.dim {
  color: var(--muted);
}

.section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.4rem 3rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.15rem 1.2rem 1.25rem;
}

.card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.94rem;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.ticks {
  margin: 0;
  padding: 0.4rem 0 0 1.1rem;
  color: var(--ink);
  line-height: 1.8;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
}

.cta-band {
  max-width: 1080px;
  margin: 0 auto 3rem;
  padding: 2rem 1.5rem;
  text-align: center;
  background: #e8efe6;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.cta-band p {
  color: var(--muted);
  margin: 0 0 1rem;
}

.site-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.2rem 1.4rem 2rem;
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
  color: var(--muted);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.84rem;
}

.foot-links {
  display: flex;
  gap: 1rem;
}

.foot-links a {
  color: var(--muted);
  text-decoration: none;
}

.foot-links a:hover {
  color: var(--accent);
}

.legal {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.2rem 1.4rem 3rem;
}

.legal h1 {
  font-size: 2.1rem;
  margin: 0 0 0.35rem;
}

.legal-updated {
  margin: 0 0 1.6rem;
  color: var(--muted);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.88rem;
}

.legal h2 {
  font-size: 1.2rem;
  margin: 1.7rem 0 0.45rem;
}

.legal p,
.legal li {
  line-height: 1.55;
}

.legal ul {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}

.legal li + li {
  margin-top: 0.35rem;
}

.legal-agree {
  margin: 0.15rem 0 0;
  text-align: center;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

.auth-body .auth-main {
  min-height: calc(100dvh - 4rem);
  display: grid;
  place-items: start center;
  padding: 2.5rem 1rem 3rem;
}

.auth-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.5rem 1.4rem 1.6rem;
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.75rem;
}

.auth-card h1 {
  font-size: 1.7rem;
  margin: 0;
}

.auth-card .lede {
  margin: 0;
  font-size: 0.98rem;
}

.auth-card label {
  display: grid;
  gap: 0.28rem;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.82rem;
  color: var(--muted);
}

.auth-card input {
  min-height: 2.7rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
}

.form-error {
  margin: 0;
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  background: #f8e6d8;
  color: #8a1f1f;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.88rem;
}

.form-error:empty {
  display: none;
}

.auth-switch {
  margin: 0.2rem 0 0;
  text-align: center;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.9rem;
  color: var(--muted);
}

.admin-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.2rem 3rem;
}

.admin-main h1 {
  font-size: 1.8rem;
}

.admin-main h2 {
  margin-top: 1.6rem;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.admin-table .actions {
  display: flex;
  gap: 0.4rem;
  white-space: nowrap;
}

.admin-table .actions form {
  margin: 0;
}

.admin-table .btn {
  min-height: 2.2rem;
  padding: 0.25rem 0.7rem;
  font-size: 0.82rem;
}

.notice-band {
  max-width: 1080px;
  margin: 0 auto 1.5rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #efe8d8;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--ink);
}

.notice-band p {
  margin: 0;
}

.example-body {
  min-height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

html:has(body.example-body) {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}

.example-body .site-nav {
  flex: 0 0 auto;
  position: relative;
}

.example-banner {
  flex: 0 0 auto;
  padding: 0.45rem 1.4rem 0.55rem;
  background: #efe8d8;
  border-bottom: 1px solid var(--line);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.82rem;
  line-height: 1.35;
}

.example-banner p {
  margin: 0 auto;
  max-width: 1100px;
}

.example-stories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.45rem auto 0;
  max-width: 1100px;
}

.example-stories a {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
}

.example-stories a.active {
  background: #0b3d2e;
  border-color: #0b3d2e;
  color: #fff;
}

.example-layout {
  display: grid;
  grid-template-columns: 1fr 12px var(--example-panel-w, minmax(280px, 0.9fr));
  gap: 0;
  flex: 1 1 auto;
  min-height: 0;
  height: 0;
}

.example-map {
  position: relative;
  min-height: 0;
  height: 100%;
  background: #d7e3d4;
}

.example-panel-resizer {
  position: relative;
  z-index: 8;
  margin: 0 -6px;
  cursor: col-resize;
  touch-action: none;
}

.example-panel-resizer::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 2.6rem;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: #c2bbae;
}

.example-panel-resizer:hover::after,
.example-body.example-panel-resizing .example-panel-resizer::after {
  background: #0b3d2e;
}

.example-body.example-panel-resizing {
  cursor: col-resize;
  user-select: none;
}

.example-body.example-panel-resizing .example-map,
.example-body.example-panel-resizing .example-panel {
  pointer-events: none;
}

.example-basemap {
  position: absolute;
  top: 0.65rem;
  left: 0.65rem;
  z-index: 2;
  display: inline-flex;
  gap: 0;
  border: 1px solid rgba(26, 36, 24, 0.28);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 4px rgba(26, 36, 24, 0.12);
}

.example-basemap button {
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
}

.example-basemap button + button {
  border-left: 1px solid rgba(26, 36, 24, 0.18);
}

.example-basemap button.active {
  background: #0b3d2e;
  color: #fff;
}

.example-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  background: var(--panel);
  border-left: 1px solid var(--line);
}

.example-sheet-handle {
  display: none;
}

.example-sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.2rem 1.3rem 2rem;
}

.example-body .site-foot {
  display: none;
}

.example-kicker {
  margin: 0 0 0.35rem;
  color: var(--accent-2);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.example-panel h1 {
  font-size: 1.55rem;
}

.example-panel h2 {
  margin-top: 1.2rem;
  font-size: 1.15rem;
}

.example-facts {
  margin: 1rem 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem 0.8rem;
  font-size: 0.92rem;
}

.example-facts dt {
  color: var(--muted);
}

.example-facts dd {
  margin: 0;
  font-weight: 600;
}

.example-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.4rem;
}

.opp-reports {
  display: grid;
  gap: 0.55rem;
}

.opp-flag {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0.55rem 0.7rem 0.7rem;
}

.opp-flag.flagged {
  border-color: #8aa88a;
  background: #f3f7f2;
}

.opp-flag summary {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
}

.opp-flag-name {
  font-weight: 700;
}

.opp-flag-screen {
  color: var(--muted);
  font-size: 0.86rem;
}

.opp-flag p {
  margin: 0.55rem 0 0;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.86rem;
  line-height: 1.4;
  color: var(--ink);
}

.opp-table-wrap {
  overflow: auto;
  margin-top: 0.7rem;
}

.opp-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 0.78rem;
}

.opp-table th,
.opp-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.4rem 0.45rem;
  border-bottom: 1px solid var(--line);
}

.opp-table .check-pass {
  color: #2f6b3a;
  font-weight: 700;
}

.opp-table .check-fail {
  color: #b86a1c;
  font-weight: 700;
}

.opp-table .check-unknown {
  color: #5c6b57;
  font-weight: 700;
}

@media (max-width: 860px), (max-height: 560px) and (orientation: landscape) {
  .example-body {
    --example-sheet-h: 38dvh;
  }

  .example-banner {
    padding: 0.4rem 0.85rem 0.5rem;
  }

  .example-banner p {
    font-size: 0.78rem;
  }

  .example-stories {
    gap: 0.3rem;
    margin-top: 0.35rem;
  }

  .example-stories a {
    padding: 0.24rem 0.55rem;
    font-size: 0.76rem;
  }

  .example-layout {
    position: relative;
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    height: 0;
  }

  .example-panel-resizer {
    display: none;
  }

  .example-map {
    position: absolute;
    inset: 0;
    min-height: 0;
    height: 100%;
    /* Keep pinch-zoom / pan on the map above the sheet. */
    touch-action: pan-x pan-y pinch-zoom;
  }

  .example-basemap {
    top: 0.5rem;
    left: 0.5rem;
  }

  .example-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    width: 100%;
    max-width: 100vw;
    height: var(--example-sheet-h);
    max-height: none;
    border-left: none;
    border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -10px 32px rgba(26, 36, 24, 0.16);
    padding-bottom: env(safe-area-inset-bottom);
    overflow: hidden;
    box-sizing: border-box;
  }

  .example-body.example-sheet-dragging .example-panel {
    transition: none;
  }

  .example-panel:not(.example-sheet-dragging) {
    transition: height 0.22s ease;
  }

  .example-sheet-handle {
    display: block;
    flex: 0 0 auto;
    width: 100%;
    height: 1.75rem;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: grab;
    touch-action: none;
  }

  .example-sheet-handle::before {
    content: "";
    display: block;
    width: 2.4rem;
    height: 0.28rem;
    margin: 0.45rem auto 0;
    border-radius: 999px;
    background: #c2bbae;
  }

  .example-sheet-body {
    padding: 0 0.85rem 1.1rem;
    overscroll-behavior: contain;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* pan only — pinch is handled in JS so the browser does not steal it */
    touch-action: pan-x pan-y;
    max-width: 100%;
    box-sizing: border-box;
  }

  .example-sheet-body .example-sheet-content {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    transform-origin: 0 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .example-sheet-body.example-sheet-zoomed {
    overflow-x: auto;
    overflow-y: auto;
  }

  .example-sheet-body.example-sheet-pinching {
    touch-action: none;
  }

  .example-sheet-body .opp-table-wrap {
    overflow-x: visible;
    max-width: 100%;
  }

  .example-sheet-body .opp-table {
    width: 100%;
    table-layout: fixed;
    font-size: 0.72rem;
    white-space: normal;
  }

  .example-sheet-body .opp-table th,
  .example-sheet-body .opp-table td {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    padding: 0.35rem 0.3rem;
  }

  .example-sheet-body .example-facts {
    grid-template-columns: minmax(0, 7.5rem) minmax(0, 1fr);
    gap: 0.4rem 0.65rem;
    font-size: 0.92rem;
  }

  .example-sheet-body .example-facts dt,
  .example-sheet-body .example-facts dd {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .example-panel h1 {
    font-size: 1.28rem;
    overflow-wrap: anywhere;
  }

  .maplibregl-ctrl-bottom-left,
  .maplibregl-ctrl-bottom-right {
    bottom: calc(var(--example-sheet-h) + 0.35rem);
  }

  .hero,
  .cards,
  .split {
    grid-template-columns: 1fr;
  }

  .nav-links a:not(.btn) {
    display: none;
  }

  .hero {
    padding-top: 1.8rem;
  }

  .hero-panel {
    min-height: 200px;
  }
}

@media (max-height: 560px) and (orientation: landscape) {
  .example-body {
    --example-sheet-h: 42dvh;
  }

  .example-body .site-nav {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
  }

  .example-banner {
    padding: 0.25rem 0.7rem 0.35rem;
  }

  .example-banner p {
    display: none;
  }

  .example-stories {
    margin-top: 0;
  }

  .example-sheet-handle {
    height: 1.45rem;
  }

  .example-panel h1 {
    font-size: 1.1rem;
  }
}
