:root {
  --navy: #13233f;
  --navy-2: #1d3358;
  --gold: #c79a3a;
  --cream: #f7f1e8;
  --paper: #fffdf9;
  --ink: #1d2430;
  --muted: #617086;
  --line: #dfd5c5;
  --success: #1e6b54;
  --shadow: 0 18px 50px rgba(19, 35, 63, 0.1);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #fcfaf6 0%, #f5efe5 100%);
  line-height: 1.6;
}

a {
  color: var(--navy);
  text-decoration: none;
}

a:hover {
  color: var(--gold);
}

img {
  max-width: 100%;
  height: auto;
}

.shell {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  max-width: 1400px;
  margin: 0 auto;
  gap: 14px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  min-width: 0;
}

.logo-area:hover {
  color: #fff;
}

.logo-area img {
  height: 50px;
  width: auto;
}

.brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.brand small {
  display: block;
  font-size: .7rem;
  font-weight: 400;
  color: var(--gold);
  letter-spacing: .5px;
}

.veteran-badge {
  background: var(--gold);
  color: var(--navy);
  font-size: .65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav a {
  color: #fff;
  padding: 8px 12px;
  font-size: .875rem;
  border-radius: 4px;
  transition: background .2s;
}

.site-nav a:hover,
.site-nav a.active {
  background: rgba(255,255,255,.12);
  color: #fff;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
}

.header-cta {
  display: inline-block;
  background: var(--gold);
  color: var(--navy);
  padding: 8px 16px;
  border-radius: 4px;
  font-weight: 700;
  font-size: .875rem;
  transition: background .2s;
}

.header-cta:hover {
  background: #d4b882;
  color: var(--navy);
}

.header-phone {
  color: var(--gold) !important;
  font-weight: 700;
  font-size: .875rem;
  white-space: nowrap;
}

.header-phone:hover {
  color: #fff !important;
}

.topbar {
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  color: #f8f3ea;
  text-align: center;
  padding: 0.7rem 1rem;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.hero {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr;
  gap: 1.5rem;
  padding: 2.5rem 0 2rem;
}

.hero-copy h1 {
  font-size: clamp(2.25rem, 5vw, 4.25rem);
  line-height: 0.98;
  margin: 0.25rem 0 1rem;
  color: var(--navy);
}

.eyebrow {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(199, 154, 58, 0.14);
  color: #7d5712;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.lede, .section-head p, .hero-card p, .hero-card li, label span, .recommendation, .fine-print, #resultsMeta {
  color: var(--muted);
}

.trust-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.trust-row span {
  background: rgba(19, 35, 63, 0.06);
  border: 1px solid rgba(19, 35, 63, 0.08);
  padding: 0.7rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
}

.hero-card,
.card {
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.75);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 1.4rem;
  align-self: start;
}

.workspace {
  display: grid;
  gap: 1.25rem;
  padding-bottom: 3rem;
}

.card {
  padding: 1.3rem;
}

.section-head {
  margin-bottom: 1rem;
}
.section-head h2 {
  margin: 0 0 0.35rem;
  color: var(--navy);
}
.section-head.split {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
}

.grid-form {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.helper-text {
  grid-column: 1 / -1;
  margin: -0.2rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

label {
  display: grid;
  gap: 0.45rem;
}

label span {
  font-size: 0.9rem;
  font-weight: 600;
}

input, select, textarea, button {
  font: inherit;
}

input, select, textarea {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 14px;
  padding: 0.88rem 0.95rem;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: 3px solid rgba(199, 154, 58, 0.18);
  border-color: var(--gold);
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: end;
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 0.9rem 1.15rem;
  cursor: pointer;
  font-weight: 700;
}

.btn-primary {
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  color: white;
}

.btn-secondary {
  background: rgba(19, 35, 63, 0.08);
  color: var(--navy);
}

.results-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1.25rem;
  align-items: start;
}

.route-list {
  display: grid;
  gap: 0.9rem;
}

.route-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
  background: var(--paper);
  display: grid;
  gap: 0.85rem;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.route-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(19, 35, 63, 0.08);
}

.route-top,
.route-metrics,
.route-bottom {
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.route-id {
  font-weight: 800;
  color: var(--navy);
}

.badge {
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(199, 154, 58, 0.15);
  color: #7d5712;
}

.metric {
  min-width: 90px;
}
.metric span {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}
.metric strong {
  font-size: 1.05rem;
}

.route-card.selected {
  border-color: rgba(30, 107, 84, 0.45);
  box-shadow: 0 0 0 3px rgba(30, 107, 84, 0.1);
}

.route-card.active-map {
  border-color: rgba(199, 154, 58, 0.7);
  box-shadow: 0 0 0 3px rgba(199, 154, 58, 0.14);
}

.select-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(19, 35, 63, 0.06);
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(19, 35, 63, 0.08);
}

.route-select-btn {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  color: var(--navy);
  font-weight: 700;
}

.route-select-btn[aria-pressed="true"] {
  background: rgba(30, 107, 84, 0.12);
  border-color: rgba(30, 107, 84, 0.25);
  color: var(--success);
}

.sidebar {
  display: grid;
  gap: 1rem;
}

.sticky-card {
  position: sticky;
  top: 1rem;
}

.summary-card {
  top: 88px;
}

.map-toolbar {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.9rem;
}

.map-toolbar-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.btn-map {
  padding: 0.75rem 1rem;
  border-radius: 999px;
}

.map-toolbar-copy {
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.4;
}

.map-panel[hidden] {
  display: none;
}

.map-panel {
  margin-bottom: 1rem;
}

.map-modal {
  border: 0;
  padding: 0;
  background: transparent;
  width: min(1200px, calc(100vw - 2rem));
  max-width: 1200px;
}

.map-modal::backdrop {
  background: rgba(8, 14, 24, 0.72);
  backdrop-filter: blur(4px);
}

.map-modal-card {
  background: rgba(255,255,255,0.96);
  border-radius: 24px;
  box-shadow: 0 22px 60px rgba(8, 14, 24, 0.28);
  padding: 1rem;
}

.map-modal-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.4rem 0.2rem 1rem;
}

.map-modal-header h3 {
  margin: 0 0 0.2rem;
  color: var(--navy);
}

.map-modal-header p {
  margin: 0;
  color: var(--muted);
}

.map-modal-preview {
  min-height: 72vh;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(19, 35, 63, 0.08);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.summary-grid div:last-child {
  grid-column: 1 / -1;
}

.summary-grid div {
  background: var(--cream);
  padding: 0.9rem;
  border-radius: 16px;
}
.summary-grid span {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
}
.summary-grid strong {
  font-size: 1.35rem;
  color: var(--navy);
}

.map-preview {
  min-height: 360px;
  border-radius: 20px;
  background: linear-gradient(180deg, #eef3fb 0%, #e4ebf6 100%);
  border: 1px solid rgba(19, 35, 63, 0.08);
  overflow: hidden;
  position: relative;
}

.leaflet-map {
  width: 100%;
  min-height: 360px;
}

.map-modal-preview .leaflet-map {
  min-height: 72vh;
}

.map-caption,
.map-empty {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.45;
}

.map-caption {
  padding: 0.75rem 0.1rem 0;
}

.map-empty {
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 220px;
  padding: 1rem;
}

.map-empty strong {
  color: var(--navy);
  margin-bottom: 0.3rem;
}

.leaflet-container {
  font: inherit;
}

.leaflet-control-zoom a {
  color: var(--navy);
}

.route-layer {
  transition: fill-opacity .16s ease, stroke-width .16s ease, opacity .16s ease;
}

.route-layer.route-layer-hover {
  fill-opacity: 0.32 !important;
  weight: 3;
}

.route-layer.route-layer-selected {
  fill-opacity: 0.42 !important;
}

.search-point-icon {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(30, 107, 84, 0.92);
  border: 3px solid rgba(255,255,255,0.95);
  box-shadow: 0 0 0 8px rgba(30, 107, 84, 0.16);
}

.recommendation {
  background: rgba(19, 35, 63, 0.05);
  border-radius: 16px;
  padding: 0.9rem;
  line-height: 1.45;
}

.stack-form {
  display: grid;
  gap: 0.85rem;
}

.submit-status {
  margin-top: 1rem;
  padding: 0.95rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(19, 35, 63, 0.05);
  color: var(--navy);
  line-height: 1.45;
}

.submit-status.success {
  background: rgba(30, 107, 84, 0.1);
  border-color: rgba(30, 107, 84, 0.25);
  color: var(--success);
}

.submit-status.error {
  background: rgba(179, 53, 62, 0.08);
  border-color: rgba(179, 53, 62, 0.18);
  color: #8c2332;
}

.brief-output {
  margin: 1rem 0 0;
  padding: 1rem;
  border-radius: 16px;
  background: #101828;
  color: #eef2f8;
  white-space: pre-wrap;
  min-height: 180px;
  overflow: auto;
}

.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,.82);
  padding: 50px 20px 30px;
  margin-top: 1rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  margin: 0 auto 30px;
}

.footer-grid h4 {
  color: var(--gold);
  margin-bottom: 12px;
  font-size: .95rem;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.footer-grid a {
  color: rgba(255,255,255,.74);
  display: block;
  padding: 3px 0;
  font-size: .9rem;
}

.footer-grid a:hover {
  color: var(--gold);
}

.footer-grid p {
  font-size: .9rem;
  line-height: 1.7;
  margin: 0;
}

.footer-bottom {
  text-align: center;
  border-top: 1px solid rgba(255,255,255,.1);
  padding-top: 20px;
  font-size: .82rem;
  color: rgba(255,255,255,.54);
}

@media (max-width: 980px) {
  .hero,
  .results-layout,
  .grid-form,
  .map-toolbar {
    grid-template-columns: 1fr;
  }

  .map-modal {
    width: calc(100vw - 1rem);
  }

  .map-modal-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .sticky-card,
  .summary-card {
    position: static;
    top: auto;
  }

  .form-actions {
    align-items: stretch;
  }

  .form-actions .btn {
    flex: 1;
  }
}

@media (max-width: 900px) {
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--navy);
    flex-direction: column;
    padding: 10px;
    border-top: 1px solid rgba(255,255,255,.1);
  }

  .site-nav.open {
    display: flex;
  }

  .site-nav a {
    padding: 12px 20px;
    width: 100%;
  }

  .nav-toggle {
    display: block;
  }

  .header-cta,
  .veteran-badge {
    display: none;
  }

  .brand {
    font-size: 1rem;
  }
}
