/* =========================================================================
   WIMI — Where Is My Inspector
   Design system for the public-facing app.
   Visual/UX layer only — no markup here assumes any change to the PHP
   data layer or SQL Server/AS400 queries.
   Palette is built around the existing WIMI mark (img/header.png): its
   teal, orange and dark charcoal, paired with a calmer navy/sea-glass
   ground so the logo stays the most saturated thing on the page.
   ========================================================================= */

:root {
  /* brand, drawn from the existing WIMI logo */
  --ink-900: #12283a;
  --ink-700: #234258;
  --ink-500: #5c7480;
  --teal-600: #128aa0;
  --teal-700: #0d6d80;
  --teal-100: #dcf1f4;
  --orange-500: #e8862a;
  --orange-600: #cf701c;

  /* neutrals */
  --sea-0: #ffffff;
  --sea-50: #f4f7f6;
  --sea-100: #e9eeed;
  --border: #dbe3e1;
  --border-strong: #b9c8c5;

  /* semantic (kept separate from brand hue) */
  --good: #2e8b57;
  --good-bg: #e4f3ea;
  --warn: #b8790e;
  --warn-bg: #faf0dd;
  --crit: #b33f32;
  --crit-bg: #fbe9e6;
  --info: #3b6fa0;
  --info-bg: #e6eef7;

  --bg: var(--sea-50);
  --surface: var(--sea-0);
  --surface-2: var(--sea-100);
  --text: var(--ink-900);
  --text-muted: var(--ink-500);
  --accent: var(--teal-600);
  --accent-strong: var(--teal-700);
  --shadow: 0 1px 2px rgba(18,40,58,.06), 0 10px 26px -14px rgba(18,40,58,.22);

  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1d29;
    --surface: #11293a;
    --surface-2: #15334a;
    --text: #e7eef1;
    --text-muted: #9db2bd;
    --border: #234258;
    --border-strong: #315c74;
    --teal-100: #123846;
    --accent: #3bb6ce;
    --accent-strong: #63cbe0;
    --good: #4fb27a; --good-bg: #123324;
    --warn: #d99a2b; --warn-bg: #3a2c0f;
    --crit: #e07567; --crit-bg: #3a1a15;
    --info: #7aa8d6; --info-bg: #16283c;
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 14px 30px -16px rgba(0,0,0,.6);
  }
}

/* ---------- reset / base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: var(--accent-strong); }
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -.01em; margin: 0 0 .4em; }
p { margin: 0 0 1em; }
.hide { display: none !important; }
.mono, .tabular { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 64rem; margin: 0 auto; padding: 0 1.25rem; }

/* ---------- buttons ---------- */
.btn {
  font: inherit;
  font-weight: 700;
  font-size: .92rem;
  border-radius: 8px;
  padding: .7em 1.3em;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  text-decoration: none;
  line-height: 1.2;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-accent { background: var(--orange-500); color: #fff; }
.btn-accent:hover { background: var(--orange-600); }
.btn-secondary { background: var(--surface); color: var(--accent-strong); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { color: var(--text); }
.btn-block { width: 100%; }

/* =========================================================================
   MASTHEAD / SEARCH HERO  (hero.php, home.php)
   ========================================================================= */
header.masthead {
  background: linear-gradient(175deg, var(--ink-900), var(--ink-700) 85%);
  color: #eef4f3;
  padding: 3rem 1.25rem 2.75rem;
  text-align: center;
}
header.masthead .brand-mark {
  width: min(420px, 82%);
  height: auto;
  margin: 0 auto 1.5rem;
  display: block;
}
header.masthead #minilogo {
  width: min(220px, 46%);
  margin: 0 auto 1rem;
  display: block;
}
.masthead-tagline {
  color: #bcd6db;
  font-size: 1rem;
  max-width: 34ch;
  margin: -.75rem auto 1.75rem;
}

/* lookup form */
#inspector_lookup { max-width: 30rem; margin: 0 auto; }
.lookup-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: end;
  gap: .75rem;
}
.field { display: flex; flex-direction: column; gap: .35rem; text-align: left; }
.field label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #a9cad0;
}
.field input, .field textarea {
  font: inherit;
  font-family: var(--font-mono);
  font-size: 1rem;
  padding: .65em .75em;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
.field input:focus { border-color: var(--accent); }
.field input.input-error { outline: 2px solid var(--crit); border-color: var(--crit); }
.wimiyear { width: 4.75rem; text-align: center; }
.wimipermitnum { width: 10rem; text-align: center; }

.how-to-link {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  margin-top: 1.35rem;
  color: #cfe6ea;
  font-size: .88rem;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(207,230,234,.4);
  padding-bottom: .15em;
}
.how-to-link:hover { color: #fff; border-color: #fff; }

/* =========================================================================
   FEATURE STRIP (feature.php)
   ========================================================================= */
.feature-strip { padding: 3rem 1.25rem; }
.feature-grid {
  max-width: 64rem;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}
@media (max-width: 720px) { .feature-grid { grid-template-columns: 1fr; gap: 2.25rem; } }
.feature-card { text-align: center; }
.feature-card .ic {
  width: 3.25rem; height: 3.25rem;
  margin: 0 auto .9rem;
  border-radius: 50%;
  background: var(--teal-100);
  color: var(--accent-strong);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem;
}
.feature-card h2 { font-size: 1.1rem; }
.feature-card p { color: var(--text-muted); font-size: .92rem; margin: 0; }

/* =========================================================================
   RESULTS  (rendered by wimi.js into #wimi_results)
   ========================================================================= */
#wimi_results { display: block; padding: 0 1.25rem 3rem; }
.results-wrap { max-width: 40rem; margin: 0 auto; }

.notice {
  border-radius: 10px;
  padding: .95rem 1.1rem;
  font-size: .92rem;
  margin-bottom: 1.25rem;
  display: flex;
  gap: .7rem;
  align-items: flex-start;
}
.notice p { margin: 0; }
.notice .close-notice {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  opacity: .6;
}
.notice .close-notice:hover { opacity: 1; }
.notice-warn { background: var(--warn-bg); color: var(--warn); border: 1px solid rgba(184,121,14,.25); }
.notice-crit { background: var(--crit-bg); color: var(--crit); border: 1px solid rgba(179,63,50,.25); }

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1.1rem;
  background: var(--surface-2);
  flex-wrap: wrap;
}
.result-head .permit { font-family: var(--font-mono); font-size: .8rem; color: var(--text-muted); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: .4em;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .01em;
  padding: .3em .75em;
  border-radius: 999px;
  white-space: nowrap;
}
.pill::before { content: ""; width: .5em; height: .5em; border-radius: 50%; background: currentColor; flex: none; }
.pill-pending { background: var(--warn-bg); color: var(--warn); }
.pill-done { background: var(--info-bg); color: var(--info); }

.result-body { padding: 1.1rem; }
.result-body dl { margin: 0; display: grid; grid-template-columns: 9rem 1fr; gap: .55rem 1rem; }
.result-body dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 700; align-self: baseline; }
.result-body dd { margin: 0; }
.result-body .eta-time { font-family: var(--font-mono); font-weight: 700; color: var(--accent-strong); }

.result-foot {
  display: flex;
  justify-content: flex-end;
  padding: .85rem 1.1rem;
  border-top: 1px solid var(--border);
  gap: .6rem;
}

/* =========================================================================
   FOOTER (footer.php)
   ========================================================================= */
footer.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  text-align: center;
  padding: 1.1rem 1.25rem;
  font-size: .84rem;
}

/* =========================================================================
   GUIDE PAGE (home.php, instructions.php)
   ========================================================================= */
#guide { padding: 2.5rem 1.25rem 3.5rem; }
#guide .wrap { max-width: 54rem; }
.guide-step {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 1.75rem;
  align-items: center;
  padding: 1.75rem 0;
  border-top: 1px solid var(--border);
}
.guide-step:first-child { border-top: none; }
@media (max-width: 700px) { .guide-step { grid-template-columns: 1fr; } }
.guide-step .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem; height: 1.9rem;
  border-radius: 50%;
  background: var(--teal-100);
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: .85rem;
  margin-bottom: .6rem;
}
.guide-step p { font-size: 1rem; color: var(--text); margin: 0; }
.guide-step img {
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

/* =========================================================================
   ROUTE PAGE (routeplan.php, routecard.php, esrimap.php wrapper)
   ========================================================================= */
body.route-page { background: var(--bg); }
.route-shell {
  max-width: 78rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
  display: grid;
  grid-template-columns: minmax(20rem, 26rem) 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 900px) { .route-shell { grid-template-columns: 1fr; } }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  color: var(--accent-strong);
  font-weight: 600;
  font-size: .88rem;
  text-decoration: none;
  margin-bottom: 1rem;
}
.back-link:hover { text-decoration: underline; }

.route-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.route-card .rc-head {
  background: var(--ink-900);
  color: #eef4f3;
  padding: 1rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.route-card .rc-head img { width: 2.5rem; height: auto; }
.route-card .rc-head h4 { margin: 0; font-size: 1.05rem; }
.route-card .rc-head a { color: #cfe6ea; font-size: .82rem; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: .4em; }
.route-card .rc-head a:hover { color: #fff; }

.route-card dl.rc-facts {
  margin: 0;
  padding: 1.1rem 1.1rem 0;
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: .6rem 1rem;
}
.route-card dl.rc-facts dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 700; }
.route-card dl.rc-facts dd { margin: 0; }

.route-card .rc-stops {
  list-style: none;
  margin: 1rem 1.1rem 0;
  padding: 0;
  border-top: 1px solid var(--border);
}
.route-card .rc-stops li {
  padding: .6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .84rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  gap: .75rem;
}
.route-card .rc-stops li.matched {
  color: var(--text);
  font-weight: 700;
  background: var(--teal-100);
  margin: 0 -1.1rem;
  padding: .6rem 1.1rem;
  border-radius: 8px;
}
.route-card .rc-stops li .done-mark { color: var(--good); }

.route-card .rc-foot { padding: 1rem 1.1rem 1.1rem; }

/* map */
.map-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  min-height: 24rem;
}
.map-card img#mapplaceholder { display: block; width: 100%; height: auto; }
#esrimap { padding: 1rem; }
#esrimap h3 {
  text-align: left;
  text-decoration: none;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: .75rem;
}
#map {
  display: block;
  width: 100%;
  height: 32rem;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
#mapmess { display: block; font-size: .8rem; color: var(--text-muted); margin-top: .6rem; }
.blinkme { animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .blinkme { animation: none; } }

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 480px) {
  header.masthead { padding: 2.25rem 1rem 2rem; }
  .lookup-row { gap: .6rem; }
  #map { height: 20rem; }
}

/* =========================================================================
   PROOF OF CONCEPT BANNER — remove this block when wiring up real data
   ========================================================================= */
.poc-banner {
  background: var(--orange-500);
  color: #2a1a05;
  font-size: .8rem;
  font-weight: 600;
  text-align: center;
  padding: .5rem 1rem;
}
