/* 舊飛行場 airfields — editorial print, zero build */

:root {
  --bg: #f6f3ee;
  --fg: #1c1b19;
  --muted: #6b6660;
  --rule: #dcd6cc;
  --accent: #1f4e79;
  --land: #e6e0d6;
  --sans: "Noto Sans TC", system-ui, -apple-system, "Segoe UI", "PingFang TC",
    "Microsoft JhengHei", sans-serif;
  --serif: "Noto Serif TC", "Songti TC", "Source Han Serif TC", Georgia, serif;
  --mono: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  --pad: 24px;
  --col: 1040px;
  --panel-w: 380px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101210;
    --fg: #ebe7e0;
    --muted: #9a948b;
    --rule: #2a2b28;
    --accent: #d9b98a;
    --land: #1b1d1a;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 19px;
  line-height: 1.7;
  overflow-x: hidden;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

.serif { font-family: var(--serif); font-weight: 700; }

a { color: inherit; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

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

/* ---------- layout ---------- */

.site-head,
.col,
.site-foot {
  max-width: var(--col);
  margin: 0 auto;
  padding-left: var(--pad);
  padding-right: var(--pad);
}

.bleed { width: 100%; }

.site-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  padding-bottom: 16px;
}

.brand {
  font-size: 16px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}

.brand:hover { color: var(--fg); }

.site-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.08em;
}

.col > section { padding-block: 56px; }

.col > section + section { border-top: 1px solid var(--rule); }

.sec-h {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 32px;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: 0.22em;
  color: var(--muted);
}

.sec-h .sec-n {
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.sec-h::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--rule);
}

/* ---------- hero ---------- */

.col > section.hero { padding-top: 24px; padding-bottom: 48px; }

.lede {
  margin: 0;
  font-size: clamp(32px, 6vw, 52px);
  line-height: 1.4;
  letter-spacing: 0.01em;
  max-width: 18em;
}

.meta {
  margin: 16px 0 0;
  font-size: 16px;
  color: var(--muted);
}

.totals {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px 24px;
  margin: 48px 0 0;
}

.total {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-top: 8px;
  border-top: 1px solid var(--rule);
}

.num {
  margin: 8px 0 0;
  font-size: 46px;
  line-height: 1;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.label {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

/* ---------- map ---------- */

.mapwrap {
  position: relative;
  width: 100%;
  height: 70vh;
  min-height: 440px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

#map {
  position: absolute;
  inset: 0;
  background: var(--bg);
}

.map-note {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 600;
  margin: 0;
  padding: 8px var(--pad);
  background: var(--bg);
  border-top: 1px solid var(--rule);
  font-size: 15px;
  color: var(--muted);
}

/* Leaflet chrome：細框、無圓角、無陰影 */

.leaflet-container {
  background: var(--bg);
  font-family: var(--sans);
  font-size: 12px;
}

.leaflet-container a { color: var(--fg); }

.leaflet-bar,
.leaflet-control,
.leaflet-touch .leaflet-bar,
.leaflet-touch .leaflet-control-layers {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.leaflet-bar a,
.leaflet-bar a:hover,
.leaflet-touch .leaflet-bar a {
  width: 30px;
  height: 30px;
  line-height: 28px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--rule);
  border-radius: 0;
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 400;
}

.leaflet-bar a:hover { color: var(--accent); }

.leaflet-bar a:first-child,
.leaflet-bar a:last-child,
.leaflet-touch .leaflet-bar a:first-child,
.leaflet-touch .leaflet-bar a:last-child { border-radius: 0; }

.leaflet-control-zoom-in { margin-bottom: 6px; }

.leaflet-bar a.leaflet-disabled {
  background: var(--bg);
  color: var(--rule);
}

.leaflet-container .leaflet-control-attribution {
  padding: 2px 8px;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--rule);
  border-right: 0;
  border-bottom: 0;
  font-size: 12px;
  line-height: 1.6;
}

.leaflet-control-attribution a { color: var(--muted); text-decoration: underline; }
.leaflet-control-attribution a:hover { color: var(--fg); }
.leaflet-attribution-flag { display: none !important; }

.leaflet-tooltip {
  padding: 3px 8px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--rule);
  border-radius: 0;
  box-shadow: none;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
}

.leaflet-tooltip::before { display: none; }

/* 底圖切換：右上三個文字選項 */

.layer-switch {
  display: flex;
  border: 1px solid var(--rule);
  background: var(--bg);
}

.layer-switch button {
  appearance: none;
  padding: 4px 10px;
  border: 0;
  background: none;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.08em;
  line-height: 1.6;
  cursor: pointer;
}

.layer-switch button + button { border-left: 1px solid var(--rule); }
.layer-switch button:hover { color: var(--fg); }

.layer-switch button[aria-pressed="true"] {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ---------- filters ---------- */

.kind-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0 20px;
  padding: 12px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.kind-btn {
  appearance: none;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 16px;
  letter-spacing: 0.04em;
  line-height: 1.4;
  cursor: pointer;
}

.kind-btn:hover { color: var(--fg); }

.kind-btn[aria-pressed="true"] {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 5px;
}

.county-filter { margin: 20px 0 0; }

#county-select {
  appearance: none;
  max-width: 100%;
  padding: 6px 28px 6px 10px;
  background: var(--bg)
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%236b6660' stroke-width='1'/></svg>")
    no-repeat right 10px center;
  background-size: 10px 6px;
  color: var(--fg);
  border: 1px solid var(--rule);
  border-radius: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  cursor: pointer;
}

/* ---------- list ---------- */

.grp { margin: 0 0 8px; }

.grp + .grp { margin-top: 32px; }

.grp-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 4px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.grp-h .grp-n { font-family: var(--mono); font-size: 15px; letter-spacing: 0.04em; }

.row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 4px 16px;
  width: 100%;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: none;
  color: inherit;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  text-align: left;
  cursor: pointer;
}

.row:hover .r-name { color: var(--accent); }

.row[aria-current="true"] .r-name { text-decoration: underline; text-underline-offset: 5px; }

.r-name { min-width: 0; overflow-wrap: anywhere; }

.r-op {
  padding-left: 10px;
  font-size: 15px;
  color: var(--muted);
  white-space: nowrap;
}

.r-today {
  min-width: 0;
  font-size: 16px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.tag {
  padding: 1px 7px;
  border: 1px solid var(--rule);
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  white-space: nowrap;
}

.empty { margin: 24px 0 0; color: var(--muted); font-size: 17px; }

.how { margin: 0 0 8px; font-size: 17px; color: var(--muted); }

/* ---------- panel ---------- */

.panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 1200;
  width: var(--panel-w);
  max-width: 100%;
  background: var(--bg);
  border-left: 1px solid var(--rule);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 180ms ease, visibility 0s linear 180ms;
}

.panel.open {
  transform: none;
  visibility: visible;
  transition: transform 180ms ease, visibility 0s linear 0s;
}

.p-scroll {
  height: 100%;
  overflow-y: auto;
  padding: 20px 24px 40px;
}

.sheet-grip { display: none; }

.p-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.p-name {
  margin: 0;
  font-size: 26px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.p-name:focus { outline: 0; }

.p-close {
  appearance: none;
  flex: 0 0 auto;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 15px;
  letter-spacing: 0.1em;
  cursor: pointer;
}

.p-close:hover { color: var(--fg); }

.p-ja {
  margin: 6px 0 0;
  font-size: 15px;
  color: var(--muted);
}

.p-ja:empty { display: none; }

.p-facts {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  font-size: 16px;
}

.p-facts > div {
  display: grid;
  grid-template-columns: 5.5em minmax(0, 1fr);
  gap: 12px;
  padding: 6px 0;
}

.p-facts dt {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.p-facts dd { margin: 0; overflow-wrap: anywhere; }

.p-facts .tag { margin-left: 8px; }

.p-history {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  font-size: 17px;
  line-height: 1.8;
}

.p-conf {
  margin: 16px 0 0;
  font-size: 15px;
  color: var(--muted);
}

.p-conf:empty { display: none; }

.p-sources {
  margin: 16px 0 0;
  font-size: 15px;
  line-height: 1.9;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.p-sources a { color: var(--muted); text-decoration: underline; text-underline-offset: 4px; }
.p-sources a:hover { color: var(--fg); }

.p-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 24px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  font-size: 17px;
}

.p-links a { text-decoration: underline; text-underline-offset: 5px; }
.p-links a:hover { color: var(--accent); }

.linkish {
  appearance: none;
  padding: 0;
  border: 0;
  background: none;
  color: var(--fg);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 5px;
  cursor: pointer;
}

.linkish:hover { color: var(--accent); }

/* ---------- footer ---------- */

.site-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-top: 24px;
  padding-bottom: 56px;
  border-top: 1px solid var(--rule);
  font-size: 16px;
  color: var(--muted);
}

.site-foot p { margin: 0; }

/* ---------- wide ---------- */

@media (min-width: 721px) {
  /* 側欄打開時把版面往左讓，不遮住內容 */
  body.panel-open { padding-right: var(--panel-w); }
}

@media (min-width: 720px) {
  :root { --pad: 48px; }
  .col > section { padding-block: 72px; }
  .col > section.hero { padding-top: 32px; padding-bottom: 64px; }
  .sec-h { margin-bottom: 40px; }
}

/* ---------- narrow ---------- */

@media (max-width: 720px) {
  .mapwrap { height: 60vh; min-height: 360px; }

  .totals { grid-template-columns: repeat(2, 1fr); gap: 24px 16px; }
  .num { font-size: 34px; }
  .label { font-size: 14px; letter-spacing: 0.08em; }

  .site-foot { flex-direction: column; gap: 8px; }

  .row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 12px;
  }

  .r-name { grid-column: 1; }
  .r-today { grid-column: 1; }
  .tag { grid-column: 2; grid-row: 1; }

  .panel {
    top: auto;
    left: 0;
    right: 0;
    width: auto;
    max-height: 76vh;
    border-left: 0;
    border-top: 1px solid var(--rule);
    transform: translateY(100%);
  }

  .p-scroll {
    max-height: calc(76vh - 28px);
    height: auto;
    padding: 4px 20px 32px;
  }

  .sheet-grip {
    display: block;
    padding: 10px 0 8px;
    text-align: center;
    cursor: grab;
    touch-action: none;
  }

  .sheet-grip span {
    display: inline-block;
    width: 40px;
    height: 1px;
    background: var(--rule);
  }

  .p-name { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}
