/*
 * Boundary Base interface tokens.  Keep these local: the field page allows no
 * third-party visual requests and its CSP permits styles only from this host.
 * Fonts stay system-local: the page CSP is default-src 'self' and no field
 * request may reach a third-party host.
 */
:root {
  color-scheme: light;
  --lime: #72cd58;
  --lime-deep: #5cb545;
  --green: #4a7c59;
  --green-strong: #3d6849;
  --green-deep: #176a45;
  --forest: #16251e;
  --forest-deep: #101a15;
  --sage: #9bc2a6;
  --sage-soft: #eef4eb;
  --mist: #eef2ef;
  --paper: #ffffff;
  --canvas: #f4f5ef;
  --ink: #232332;
  --body: #465049;
  --muted: #667078;
  --line: #dce2df;
  --good: #176a45;
  --warn: #c17b2a;
  --warn-soft: #f7f2e8;
  --danger: #b95c2d;
  --danger-soft: #f7eee9;
  --shadow: 0 18px 55px rgba(22, 37, 30, .09);
  --radius: 4px;
}

* { box-sizing: border-box; }
html { background: var(--canvas); scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--body);
  font: 16px/1.6 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body::before { content: ""; display: block; height: 5px; background: var(--lime); }
button, input { font: inherit; }
a { color: var(--green-deep); }
button { touch-action: manipulation; }

.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.header-inner {
  display: flex;
  width: min(100% - 48px, 1120px);
  min-height: 88px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand { display: flex; align-items: center; text-decoration: none; }
.brand img { width: 62px; max-width: 100%; height: 62px; object-fit: contain; }
.product-name { display: grid; padding-left: 24px; border-left: 1px solid var(--line); text-align: right; }
.product-name span { color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.product-name strong { color: var(--ink); font-size: 14px; }
.menu-toggle { display: none; min-height: 40px; padding: 7px 12px; border-color: var(--line); background: var(--paper); color: var(--ink); }
.tool-nav { display: flex; min-height: 48px; align-items: stretch; justify-content: center; gap: 4px; border-top: 1px solid var(--line); background: #fbfcfb; }
.tool-nav a { display: flex; padding: 0 18px; align-items: center; border-bottom: 3px solid transparent; color: var(--muted); font-size: 12px; font-weight: 750; text-decoration: none; }
.tool-nav a:hover, .tool-nav a.active { border-bottom-color: var(--lime); color: var(--ink); }

main { width: min(100% - 40px, 920px); margin: 0 auto; padding: 68px 0 80px; }
section + section { margin-top: 38px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { color: var(--ink); letter-spacing: -.035em; }
h1 { max-width: 720px; margin-bottom: 18px; font-size: clamp(38px, 7vw, 66px); line-height: 1.03; }
h2 { margin-bottom: 8px; font-size: clamp(25px, 4vw, 34px); line-height: 1.15; }
h3 { margin-bottom: 4px; font-size: 19px; }

.intro-copy { margin: 0 auto 42px; text-align: center; }
.intro-copy h1 { margin-right: auto; margin-left: auto; }
.eyebrow { margin-bottom: 8px; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.lede { max-width: 680px; margin: 0 auto 20px; color: var(--body); font-size: 18px; }
.service-note { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 650; }
.service-note span { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px var(--sage-soft); }
.hero-actions { display: flex; margin-top: 26px; flex-wrap: wrap; justify-content: center; gap: 9px; }
.button-link { display: inline-flex; min-height: 48px; padding: 11px 18px; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 2px; font-size: 13px; font-weight: 760; text-decoration: none; }
.button-link.primary { color: #fff; }
.ghost { border-color: #cbd5ce; background: var(--paper); color: var(--green-deep); }
.ghost:hover { border-color: var(--green); background: var(--sage-soft); }

.location-card { padding: 36px; border: 1px solid var(--line); border-top: 4px solid var(--lime); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.card-heading { display: flex; align-items: center; gap: 16px; }
.card-heading .eyebrow { margin-bottom: 3px; }
.step-number { display: grid; width: 48px; height: 48px; flex: 0 0 48px; place-items: center; border-radius: 50%; background: var(--sage-soft); color: var(--green); font-size: 13px; font-weight: 850; }
.card-help { max-width: 720px; margin: 14px 0 22px 64px; color: var(--muted); font-size: 14px; }
.hint { margin: 10px 0 0; color: var(--muted); font-size: 13px; }

button {
  min-height: 48px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  font-weight: 760;
  transition: background-color .16s ease, border-color .16s ease, transform .16s ease;
}
button:hover { transform: translateY(-1px); }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(114, 205, 88, .38); outline-offset: 2px; }
button:disabled { cursor: wait; opacity: .55; transform: none; }
.primary { background: var(--green); color: #fff; }
.primary:hover { background: var(--green-strong); }
.secondary { display: flex; width: 100%; align-items: center; justify-content: center; gap: 10px; background: var(--forest); color: #fff; }
.secondary:hover { background: var(--forest-deep); }
.locate-button { display: flex; width: 100%; min-height: 56px; align-items: center; justify-content: center; gap: 10px; }
.target-icon { position: relative; width: 17px; height: 17px; border: 2px solid currentColor; border-radius: 50%; }
.target-icon::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: currentColor; }
.divider { display: flex; margin: 22px 0 16px; align-items: center; gap: 14px; color: #8a8f94; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }

form { margin-top: 0; }
.coordinate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
label { display: grid; gap: 6px; color: var(--body); font-size: 12px; font-weight: 750; }
input { width: 100%; min-height: 50px; padding: 10px 13px; border: 1px solid #ccd4cd; border-radius: 2px; background: #fbfcfb; color: var(--ink); }
input:hover { border-color: var(--sage); }
.workflow-card > form > label { margin: 20px 0 14px; }
.form-note { margin: -3px 0 14px; color: var(--muted); font-size: 12px; }
.status { min-height: 24px; margin: 13px 0 -8px; color: var(--muted); font-size: 13px; text-align: center; }
.status.error { color: var(--danger); }

.results { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.result-heading { display: flex; justify-content: space-between; gap: 16px; padding: 30px 32px; border-top: 4px solid var(--lime); border-bottom: 1px solid var(--line); }
.result-heading h2 { margin: 0; font-size: clamp(34px, 7vw, 50px); letter-spacing: .01em; }
.station-name, .alternatives > p, .private-note { color: var(--muted); }
.station-name { margin: 2px 0 0; }
.band { align-self: flex-start; padding: 6px 11px; border-radius: 999px; background: var(--sage-soft); color: var(--good); font-size: 10px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.band.caution, .band.warning { background: var(--warn-soft); color: var(--warn); }
.band.beyond { background: var(--danger-soft); color: var(--danger); }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); background: var(--mist); }
.metrics > div { padding: 17px 22px; }
.metrics > div + div { border-left: 1px solid var(--line); }
.metrics span, .copy-row > span { display: block; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.metrics strong { display: block; margin-top: 3px; color: var(--ink); font-size: 15px; }
.settings { padding: 30px 32px; background: var(--paper); }
.settings-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.settings-title > span { color: var(--muted); font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.copy-grid { margin: 19px 0; border-top: 1px solid var(--line); }
.copy-row { display: grid; min-height: 62px; grid-template-columns: 1fr minmax(120px, auto) 64px; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.copy-row code { overflow: hidden; color: var(--ink); font: 14px ui-monospace, SFMono-Regular, Menlo, monospace; text-align: right; text-overflow: ellipsis; }
.copy-row button { min-height: 34px; padding: 5px 9px; border-color: #cbd5ce; background: transparent; color: var(--green); font-size: 11px; }
.copy-row button:hover { border-color: var(--green); background: var(--sage-soft); }
.settings > .primary { width: 100%; }
.private-note { margin: 12px 0 0; font-size: 12px; }
.alternatives { padding: 28px 32px 32px; border-top: 1px solid var(--line); background: var(--mist); }
.alternative-list { display: grid; gap: 8px; margin-top: 14px; }
.alternative { display: grid; width: 100%; min-height: 60px; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 13px; border-color: var(--line); background: var(--paper); color: var(--ink); text-align: left; }
.alternative:hover { border-color: var(--lime); }
.alternative strong { font-size: 15px; }
.alternative span { grid-row: span 2; align-self: center; color: var(--green); font-size: 13px; }
.alternative small { color: var(--muted); font-weight: 500; }
.result-actions { display: flex; margin-top: 14px; justify-content: flex-end; gap: 10px; }
.source-result-actions { margin: 0; padding: 20px 32px; border-top: 1px solid var(--line); }

.page-intro { margin-bottom: 38px; text-align: center; }
.page-intro h1, .page-intro .lede { margin-right: auto; margin-left: auto; }
.workflow-card, .decision-result, .field-sheet, .station-map-wrap { padding: 34px; border: 1px solid var(--line); border-top: 4px solid var(--lime); background: var(--paper); box-shadow: var(--shadow); }
fieldset { margin: 18px 0; padding: 0; border: 0; }
legend { margin-bottom: 9px; color: var(--ink); font-size: 14px; font-weight: 800; }
legend small { color: var(--muted); font-weight: 500; }
.choice-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.choice-row label { display: flex; min-height: 50px; padding: 10px 13px; align-items: center; gap: 9px; border: 1px solid var(--line); background: #fbfcfb; color: var(--ink); cursor: pointer; font-size: 14px; }
.choice-row label:has(input:checked) { border-color: var(--green); background: var(--sage-soft); }
.choice-row input { width: 18px; min-height: 18px; accent-color: var(--green); }
.recommendation-head { padding-bottom: 24px; }
.recommendation-head h2 { font-size: clamp(30px, 6vw, 45px); }
.recommendation-head p:last-child { margin: 0; color: var(--muted); }
.decision-metrics { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 -34px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--mist); }
.decision-metrics > div { padding: 17px 22px; }
.decision-metrics > div + div { border-left: 1px solid var(--line); }
.decision-metrics span { display: block; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.decision-metrics strong { color: var(--ink); }
.reason-panel, .workflow-steps { margin-top: 26px; }
.reason-panel { padding: 20px; border-left: 3px solid var(--lime); background: var(--sage-soft); }
.reason-panel p { margin: 5px 0 0; }
.workflow-steps ol { margin: 12px 0 0; padding-left: 24px; }
.workflow-steps li { margin: 8px 0; padding-left: 5px; }
.notice { margin: 18px 0; padding: 15px 17px; border-left: 3px solid var(--green); background: var(--sage-soft); color: var(--body); font-size: 13px; }
.notice p { margin: 5px 0 0; }
.warning-notice { border-left-color: var(--warn); background: var(--warn-soft); }
.danger-notice { border-left-color: var(--danger); background: var(--danger-soft); }

.field-sheet { color: #222; }
.sheet-title { display: flex; padding-bottom: 18px; align-items: flex-start; justify-content: space-between; border-bottom: 2px solid #222; }
.sheet-title strong { text-transform: uppercase; }
.sheet-title h2 { margin: 2px 0 0; text-transform: uppercase; }
.sheet-title span { color: var(--muted); font-size: 11px; }
.sheet-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 24px; margin: 20px 0; }
.sheet-field { padding: 9px 0; border-bottom: 1px solid var(--line); }
.sheet-field span { display: block; color: var(--muted); font-size: 10px; font-weight: 750; text-transform: uppercase; }
.sheet-field strong { overflow-wrap: anywhere; }
.sheet-checks { padding-top: 10px; }
.sheet-checks p { margin: 7px 0; }
.sheet-actions { display: flex; margin-top: 24px; gap: 10px; }

.station-map-wrap { margin: 22px 0 36px; }
.map-heading, .station-table-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.map-heading > p, .station-table-head > span { max-width: 340px; color: var(--muted); font-size: 12px; text-align: right; }
.station-map { width: 100%; min-height: 390px; margin-top: 18px; border: 1px solid var(--line); background: linear-gradient(#f7faf7, #edf3ee); }
.map-point { fill: var(--green); stroke: #fff; stroke-width: 2; }
.map-point.preferred { fill: var(--lime-deep); r: 8; }
.map-job { fill: var(--forest); stroke: #fff; stroke-width: 3; }
.map-label { fill: var(--ink); font-size: 10px; font-weight: 800; }
.station-list { display: grid; gap: 10px; }
.station-card { display: grid; grid-template-columns: minmax(150px, 1.3fr) repeat(3, minmax(90px, .7fr)); gap: 14px; padding: 18px; align-items: center; border: 1px solid var(--line); background: var(--paper); }
.station-card.preferred { border-left: 4px solid var(--lime); }
.station-card h3 { margin: 0; font-size: 17px; }
.station-card p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.station-card div > span { display: block; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.station-card div > strong { color: var(--ink); font-size: 13px; }
.station-metadata { grid-column: 1 / -1; padding-top: 10px; border-top: 1px solid var(--line); }
.station-metadata summary { color: var(--green-deep); cursor: pointer; font-size: 12px; font-weight: 800; }
.metadata-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 13px; }
.metadata-grid > div { min-width: 0; }
.metadata-grid strong { overflow-wrap: anywhere; }
.archive-heading { display: flex; margin-top: 38px; padding-top: 30px; align-items: flex-start; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); }
.archive-heading > span { color: var(--muted); font-size: 12px; }
.rinex-files { display: grid; gap: 10px; }
.rinex-file { display: grid; grid-template-columns: minmax(210px, 1.5fr) repeat(3, minmax(90px, .65fr)) auto; gap: 14px; padding: 17px; align-items: center; border: 1px solid var(--line); background: var(--paper); }
.rinex-file.primary-file { border-left: 4px solid var(--lime); }
.rinex-file h3 { margin: 0; overflow-wrap: anywhere; font: 700 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0; }
.rinex-file p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.rinex-file > div > span { display: block; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.rinex-file > div > strong { color: var(--ink); font-size: 12px; }
.download-link { min-height: 40px; padding: 8px 13px; white-space: nowrap; }

.reference-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.reference-grid details { padding: 18px 20px; border: 1px solid var(--line); background: var(--paper); }
.reference-grid summary { color: var(--ink); cursor: pointer; font-weight: 800; }
.reference-grid p { margin: 12px 0 0; color: var(--body); font-size: 14px; }

body.field-mode .site-header, body.field-mode .intro-copy, body.field-mode .privacy, body.field-mode footer { display: none; }
body.field-mode main { padding-top: 12px; }
body.field-mode .location-card { box-shadow: none; }

.privacy { display: flex; padding: 30px 32px; align-items: flex-start; gap: 18px; border-left: 3px solid var(--lime); background: var(--sage-soft); }
.privacy-icon { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border-radius: 50%; background: var(--green); color: #fff; font-weight: 850; }
.privacy h2 { margin-bottom: 7px; font-size: 23px; }
.privacy p:last-child { margin: 0; color: #5f6d63; font-size: 14px; }

footer { padding: 36px max(24px, env(safe-area-inset-right)) max(38px, env(safe-area-inset-bottom)); background: var(--forest); color: rgba(255, 255, 255, .7); }
.footer-inner { display: flex; width: min(100%, 1120px); margin: 0 auto; align-items: center; justify-content: space-between; gap: 36px; }
.footer-brand { flex: 0 0 auto; }
.footer-brand img { width: 68px; max-width: 100%; height: 68px; object-fit: contain; }
footer p { max-width: 660px; margin: 0; font-size: 11px; text-align: right; }
footer p strong { color: #fff; }
[hidden] { display: none !important; }

@media (max-width: 640px) {
  .header-inner { width: min(100% - 28px, 1120px); min-height: 74px; }
  .brand img { width: 52px; height: 52px; }
  .product-name { display: none; }
  .menu-toggle { display: block; }
  .tool-nav { display: none; padding: 8px 14px 13px; }
  .tool-nav.open { display: grid; }
  .tool-nav a { min-height: 44px; padding: 0 12px; border: 0; border-left: 3px solid transparent; }
  .tool-nav a.active { border-left-color: var(--lime); background: var(--sage-soft); }
  main { width: min(100% - 24px, 920px); padding: 44px 0 54px; }
  .intro-copy { margin-bottom: 30px; }
  .lede { font-size: 16px; }
  .location-card { padding: 24px 20px; }
  .card-heading { gap: 11px; }
  .step-number { width: 40px; height: 40px; flex-basis: 40px; }
  .card-help { margin-left: 0; }
  .coordinate-grid, .metrics, .choice-row, .decision-metrics, .sheet-grid, .reference-grid, .metadata-grid { grid-template-columns: 1fr; }
  .metrics > div + div { border-top: 1px solid var(--line); border-left: 0; }
  .result-heading, .settings, .alternatives { padding-right: 20px; padding-left: 20px; }
  .copy-row { grid-template-columns: 1fr 62px; gap: 4px 10px; padding: 8px 0; }
  .copy-row > span, .copy-row code { grid-column: 1; text-align: left; }
  .copy-row button { grid-column: 2; grid-row: 1 / span 2; }
  .privacy { padding: 24px 20px; }
  .hero-actions { display: grid; }
  .workflow-card, .decision-result, .field-sheet, .station-map-wrap { padding: 24px 20px; }
  .decision-metrics { margin: 0 -20px; }
  .decision-metrics > div + div { border-top: 1px solid var(--line); border-left: 0; }
  .result-actions, .sheet-actions { display: grid; }
  .map-heading, .station-table-head { display: block; }
  .map-heading > p, .station-table-head > span { display: block; text-align: left; }
  .station-map { min-height: 320px; }
  .station-card { grid-template-columns: 1fr 1fr; }
  .station-card > div:first-child { grid-column: 1 / -1; }
  .archive-heading { display: block; }
  .rinex-file { grid-template-columns: 1fr 1fr; }
  .rinex-file > div:first-child, .rinex-file .download-link { grid-column: 1 / -1; }
  .footer-inner { display: grid; gap: 18px; }
  .footer-brand img { width: 58px; height: 58px; }
  footer p { text-align: left; }
}

@media print {
  body::before, .site-header, main > .tool-page:not(#page-decision), #page-decision > :not(#field-sheet), footer, .sheet-actions { display: none !important; }
  body, html, main { width: auto; margin: 0; padding: 0; background: #fff; }
  #page-decision, #field-sheet { display: block !important; }
  .field-sheet { border: 0; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  button { transition: none; }
}
