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

:root {
  --brand-blue: #174089;
  --brand-blue-dark: #0f2867;
  --brand-blue-light: #2a5cb8;
  --brand-gold: #f0b323;
  --brand-gold-light: #ffd563;
  --brand-gold-dark: #c89200;
  --brand-cream: #fff8e7;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #1a1a1a;
  background: var(--brand-cream);
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem;
}

.site-header {
  background: var(--brand-blue);
  color: #fff;
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 3px solid var(--brand-gold);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.site-logo {
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.site-logo:hover { color: var(--brand-gold-light); }

.site-nav {
  display: flex;
  gap: 0.75rem;
}

.site-nav a {
  color: #d4e4ff;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

.site-nav a:hover {
  color: var(--brand-blue-dark);
  background: var(--brand-gold);
}

.site-nav a.active {
  color: var(--brand-blue-dark);
  background: var(--brand-gold);
  font-weight: 600;
}

.search-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
}

#search-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 0 0 4px 4px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.search-results a {
  display: block;
  padding: 0.5rem 0.75rem;
  color: #1a1a1a;
  text-decoration: none;
  border-bottom: 1px solid #eee;
}

.airport-plan-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 0.5rem 0 0;
}

.airport-plan-actions a {
  color: var(--brand-blue);
  font-weight: 600;
}

.btn-add-plan {
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--brand-gold-dark);
  border-radius: 4px;
  background: var(--brand-gold);
  color: var(--brand-blue-dark);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.btn-add-plan:hover:not(:disabled) {
  background: var(--brand-gold-light);
}

.btn-add-plan:disabled {
  opacity: 0.7;
  cursor: default;
}

.plan-toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  padding: 0.65rem 1rem;
  background: var(--brand-blue);
  color: #fff;
  border-radius: 8px;
  font-size: 0.9rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  max-width: calc(100vw - 2rem);
  text-align: center;
  border: 2px solid var(--brand-gold);
}

.search-results a:hover,
.search-results a:focus {
  background: #fff3cc;
}

.search-results .result-meta {
  font-size: 0.85rem;
  color: #666;
}

.breadcrumbs {
  padding: 0.75rem 0;
  font-size: 0.9rem;
}

.breadcrumbs ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.breadcrumbs li:not(:last-child)::after {
  content: "›";
  margin-left: 0.25rem;
  color: #888;
}

.breadcrumbs a { color: var(--brand-blue); }

main.container {
  padding-top: 1rem;
  padding-bottom: 2rem;
}

h1 { font-size: 1.75rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.25rem; margin: 1.5rem 0 0.5rem; border-bottom: 1px solid #ddd; padding-bottom: 0.25rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 0.25rem; }

.lead { color: #555; margin: 0 0 1.5rem; }

.directory-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.directory-list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid #e5e5e5;
}

.directory-list a {
  color: var(--brand-blue);
  font-weight: 600;
  text-decoration: none;
}

.directory-list a:hover { text-decoration: underline; }

.directory-list .meta {
  display: block;
  font-size: 0.85rem;
  color: #666;
  font-weight: 400;
}

.directory-columns {
  column-count: 3;
  column-gap: 2.5rem;
}

.directory-columns li {
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
}

@media (max-width: 700px) {
  .directory-columns { column-count: 1; }
}

@media (min-width: 701px) and (max-width: 960px) {
  .directory-columns { column-count: 2; }
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

th, td {
  border: 1px solid #ddd;
  padding: 0.4rem 0.6rem;
  text-align: left;
}

th {
  background: #f0f0f0;
  font-weight: 600;
  white-space: nowrap;
}

tr:nth-child(even) td { background: #f9f9f9; }

.badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-closed {
  background: #fde8e8;
  color: #b91c1c;
}

.airport-header { margin-bottom: 1.5rem; }

.airport-header h1 {
  font-size: 1.5rem;
  line-height: 1.3;
  margin-bottom: 0.35rem;
}

.airport-location {
  color: #555;
  font-size: 1.05rem;
  margin: 0;
}

.airport-location .badge { margin-left: 0.5rem; vertical-align: middle; }

.airport-ids { font-size: 1.1rem; color: #333; }
.sep { color: #aaa; margin: 0 0.2rem; }

.remarks-list {
  margin: 0.25rem 0 1rem;
  padding-left: 1.25rem;
}

.remarks-list li { margin-bottom: 0.25rem; }

.comms-table th,
.services-table th {
  width: 42%;
  vertical-align: top;
}

.comms-table td,
.services-table td {
  font-variant-numeric: tabular-nums;
}

.comm-remarks {
  margin: 0.5rem 0 1rem;
  padding-left: 1.25rem;
  font-size: 0.9rem;
  color: #444;
}

.runway-block {
  margin-bottom: 1.5rem;
}

.runway-block h3 {
  margin-top: 1rem;
  font-size: 1.1rem;
}

.runway-table .runway-end-header th {
  text-align: left;
  background: #e8e8e8;
}

.runway-table .inline-remark {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: #555;
}

.declared-distances {
  white-space: pre-line;
  font-size: 0.85rem;
}

.facility-group {
  margin-bottom: 1.25rem;
}

.facility-group h3 {
  font-size: 1.05rem;
  margin: 0.75rem 0 0.35rem;
  border-bottom: none;
}

.facility-ops-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

@media (min-width: 600px) {
  .facility-ops-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.facility-table th {
  width: 40%;
  vertical-align: top;
}

.ownership-table td div {
  margin-bottom: 0.15rem;
}

.site-footer {
  background: #eee;
  padding: 1.5rem 0;
  font-size: 0.85rem;
  color: #666;
  margin-top: 2rem;
}

/* —— Feedback (airport corrections) —— */
.airport-plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  margin: 0.75rem 0 0;
}

.btn-feedback-inline,
.btn-feedback,
.btn-primary,
.btn-secondary {
  font: inherit;
  cursor: pointer;
  border-radius: 4px;
  padding: 0.4rem 0.85rem;
  border: 1px solid transparent;
}

.btn-feedback-inline {
  background: transparent;
  color: var(--brand-blue);
  border-color: var(--brand-blue);
  text-decoration: none;
  font-size: 0.9rem;
}

.btn-feedback-inline:hover {
  background: var(--brand-blue);
  color: #fff;
}

.feedback-section {
  margin: 2rem 0 1rem;
  padding: 1.25rem 1rem;
  background: #fff;
  border: 1px solid #d8d8d8;
  border-radius: 6px;
  border-left: 4px solid var(--brand-gold);
}

.feedback-section h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  color: var(--brand-blue-dark);
}

.feedback-lead {
  margin: 0 0 0.85rem;
  color: #444;
  font-size: 0.95rem;
}

.btn-feedback,
.btn-primary {
  background: var(--brand-blue);
  color: #fff;
  border-color: var(--brand-blue-dark);
}

.btn-feedback:hover,
.btn-primary:hover {
  background: var(--brand-blue-light);
}

.btn-secondary {
  background: #f4f4f4;
  color: #222;
  border-color: #ccc;
}

.btn-secondary:hover {
  background: #e8e8e8;
}

.feedback-dialog {
  border: none;
  border-radius: 8px;
  padding: 0;
  max-width: 28rem;
  width: calc(100% - 2rem);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.feedback-dialog::backdrop {
  background: rgba(15, 40, 103, 0.45);
}

.feedback-form {
  padding: 1.1rem 1.2rem 1.25rem;
}

.feedback-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.feedback-dialog-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--brand-blue-dark);
}

.feedback-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #666;
  padding: 0.15rem 0.4rem;
}

.feedback-close:hover {
  color: #000;
}

.feedback-field {
  margin-bottom: 0.75rem;
}

.feedback-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: #333;
}

.feedback-field .req {
  color: #b00020;
}

.feedback-field input,
.feedback-field textarea {
  width: 100%;
  font: inherit;
  padding: 0.45rem 0.55rem;
  border: 1px solid #bbb;
  border-radius: 4px;
  background: #fff;
}

.feedback-field input[readonly] {
  background: #f0f3f8;
  color: #222;
  font-weight: 600;
}

.feedback-field textarea {
  resize: vertical;
  min-height: 6rem;
}

.feedback-note {
  font-size: 0.8rem;
  color: #666;
  margin: 0 0 0.85rem;
}

.feedback-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.feedback-status {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
}

.feedback-status.is-ok {
  color: #0a6b2d;
}

.feedback-status.is-error {
  color: #b00020;
}

.feedback-honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  width: 0;
}

.feedback-setup-hint {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  color: #666;
  background: #fff8e7;
  padding: 0.5rem 0.6rem;
  border-radius: 4px;
}

.feedback-setup-hint code {
  font-size: 0.85em;
}

/* —— Live METAR report —— */
.airport-weather {
  margin: 1.25rem 0 1.5rem;
}

.wx-status {
  margin: 0;
  padding: 1rem;
  background: #fff;
  border: 1px solid #d0d7e2;
  border-radius: 8px;
  font-size: 0.95rem;
  color: #555;
}

.wx-status.is-loading {
  color: #555;
}

.metar-report {
  background: #fff;
  border: 1px solid #c5d0e0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(15, 40, 103, 0.06);
}

.metar-report-header {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  background: linear-gradient(135deg, var(--brand-blue-dark), var(--brand-blue));
  color: #fff;
}

.metar-report-title h2 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
}

.metar-station {
  margin: 0;
  font-size: 1.05rem;
}

.metar-station-name {
  display: block;
  font-size: 0.88rem;
  font-weight: 400;
  opacity: 0.9;
  margin-top: 0.15rem;
}

.metar-time {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  opacity: 0.92;
}

.metar-local,
.metar-age {
  display: inline-block;
  margin-left: 0.35rem;
}

.metar-age {
  opacity: 0.85;
  font-style: italic;
}

.metar-cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 5.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  text-align: center;
  align-self: center;
}

.metar-cat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.9;
}

.metar-cat-value {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.15;
}

.wx-cat-vfr { background: #1a7f37; color: #fff; }
.wx-cat-mvfr { background: #1a56c4; color: #fff; }
.wx-cat-ifr { background: #c41a1a; color: #fff; }
.wx-cat-lifr { background: #8b1a9e; color: #fff; }
.wx-cat-unk { background: #555; color: #fff; }

.metar-highlights {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: #d8dee8;
  border-bottom: 1px solid #d8dee8;
}

.metar-hi {
  background: #f4f7fb;
  padding: 0.7rem 0.65rem;
  text-align: center;
  min-width: 0;
}

.metar-hi-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #5a6578;
  margin-bottom: 0.2rem;
}

.metar-hi-value {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f2867;
  word-break: break-word;
  line-height: 1.25;
}

.metar-details {
  margin: 0;
  padding: 0.75rem 1.1rem 0.9rem;
  display: grid;
  gap: 0.45rem 1rem;
}

.metar-details > div {
  display: grid;
  grid-template-columns: minmax(7rem, 32%) 1fr;
  gap: 0.35rem 0.75rem;
  font-size: 0.92rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid #eef1f6;
}

.metar-details > div:last-child {
  border-bottom: none;
}

.metar-details dt {
  margin: 0;
  font-weight: 600;
  color: #4a5568;
}

.metar-details dd {
  margin: 0;
  color: #1a1a1a;
}

.metar-raw-block {
  padding: 0 1.1rem 1rem;
}

.metar-raw-block h3 {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #5a6578;
}

.metar-raw {
  margin: 0;
  padding: 0.75rem 0.85rem;
  background: #0f2867;
  color: #e8f0ff;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.metar-taf {
  margin-top: 0.65rem;
  background: #fff;
  border: 1px solid #d0d7e2;
  border-radius: 8px;
  padding: 0.5rem 0.85rem 0.75rem;
}

.metar-taf summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--brand-blue-dark);
  font-size: 0.95rem;
  padding: 0.35rem 0;
}

.metar-taf .metar-raw {
  margin-top: 0.5rem;
}

.metar-disclaimer {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: #777;
}

.metar-report--empty,
.metar-report--error {
  padding: 1rem 1.1rem;
}

.metar-report--empty h2,
.metar-report--error h2 {
  margin: 0 0 0.5rem;
  color: var(--brand-blue-dark);
  font-size: 1.1rem;
}

.metar-empty-note {
  font-size: 0.9rem;
  color: #555;
}

.metar-report--error {
  border-color: #e0b4b4;
  background: #fff8f8;
}

@media (max-width: 700px) {
  .metar-highlights {
    grid-template-columns: repeat(2, 1fr);
  }

  .metar-hi-value {
    font-size: 1rem;
  }

  .metar-details > div {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }

  .metar-report-header {
    padding: 0.9rem;
  }

  .metar-cat-value {
    font-size: 1.35rem;
  }

  .metar-raw {
    font-size: 0.8rem;
  }
}

@media (max-width: 380px) {
  .metar-highlights {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .header-inner { flex-direction: column; align-items: stretch; }
  table { font-size: 0.8rem; }
  th, td { padding: 0.3rem 0.4rem; }
}