/* Minimal styling - intended to inherit from the parent Squarespace site's
   fonts and colors via CSS variables / iframe context. Bare bones for layout,
   readability, and responsive stacking. */

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #1a1a1a;
  line-height: 1.4;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

/* Header */
.m-header h1 { margin: 0 0 0.25rem; font-size: 1.5rem; }
.m-subtitle { margin: 0 0 1rem; color: #555; }
.m-loading { color: #555; font-style: italic; }
.m-error { color: #b00020; }

/* Layout: inputs on left, map on right; stacks on small screens */
.m-layout {
  display: grid;
  grid-template-columns: minmax(320px, 380px) 1fr;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 720px) {
  .m-layout { grid-template-columns: 1fr; }
}

/* Inputs panel */
.m-inputs {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.m-field { display: flex; flex-direction: column; gap: 0.35rem; }
.m-field label { font-weight: 600; font-size: 0.9rem; }
.m-field output { font-weight: 400; color: #555; font-size: 0.85rem; }
.m-field input[type="text"] {
  padding: 0.5rem;
  border: 1px solid #bbb;
  border-radius: 3px;
  font-size: 1rem;
  width: 100%;
}
.m-checkbox { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; font-size: 0.9rem; margin-top: 0.5rem; }

/* Autocomplete */
.m-autocomplete { position: relative; }
.m-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  background: white;
  border: 1px solid #bbb;
  border-top: none;
  max-height: 260px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.m-suggestions li {
  padding: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}
.m-suggestions li:hover { background: #e8eff5; }
.m-suggestions li:first-child {
  background: #f4f8fb;
  box-shadow: inset 3px 0 0 #2a4d6e;
}
.m-suggestions li:first-child:hover { background: #e8eff5; }
.m-suggestions li strong { flex: 0 0 5ch; }
.m-suggestions li em { color: #777; font-style: normal; margin-left: auto; font-size: 0.8rem; }

/* Selected airport chip */
.m-selected {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: #eef3f7;
  border-radius: 3px;
  font-size: 0.9rem;
}
.m-selected button {
  margin-left: auto;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  color: #888;
}

/* Sliders */
.m-slider { margin: 0.75rem 0.5rem 0.25rem; }
.m-slider-disabled { opacity: 0.4; pointer-events: none; }
.noUi-target { height: 8px; }
.noUi-handle { width: 22px !important; height: 22px !important; border-radius: 50% !important;
               top: -8px !important; box-shadow: 0 1px 3px rgba(0,0,0,0.2) !important; }
.noUi-handle:before, .noUi-handle:after { display: none; }

/* Calculate button */
.m-calculate {
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  background: #2a4d6e;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
}
.m-calculate:disabled { background: #aaa; cursor: not-allowed; }
.m-calculate:not(:disabled):hover { background: #1d3a55; }

/* Map */
.m-map { min-height: 500px; }
#map { width: 100%; height: 100%; min-height: 500px; border-radius: 3px; }

/* Leg distance readouts under inputs */
.m-legdist { font-size: 0.85rem; color: #555; margin: 0.5rem 0 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.m-legchip {
  display: inline-flex;
  gap: 0.4rem;
  padding: 0.15rem 0.5rem;
  background: #f4f4f4;
  border-radius: 3px;
}

/* Results panel */
.m-results { margin-top: 2rem; padding: 1rem; border: 1px solid #ddd; border-radius: 3px; background: #fafafa; }
.m-results h2 { margin-top: 0; }
.m-results-empty { color: #777; font-style: italic; margin: 0; }
.m-calctime { color: #555; font-size: 0.85rem; margin: 0 0 0.75rem; }
.m-results-summary { margin: 0 0 1rem; font-size: 0.95rem; }

.m-rowlist { display: flex; flex-direction: column; gap: 0.5rem; }
.m-row {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  padding: 0.75rem;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "head    cta"
    "specs   cta"
    "margins cta"
    "price   cta";
  gap: 0.25rem 1rem;
  align-items: center;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
  /* Staggered reveal: animation-delay set inline per row by Alpine.
     0.5s fade, 60ms stagger -> longer-felt reveal for perceived depth. */
  animation: m-row-in 0.5s ease-out backwards;
}
.m-row:hover { border-color: #b9c8d3; }
.m-row-selected {
  border-color: #2a4d6e;
  box-shadow: 0 0 0 2px rgba(42, 77, 110, 0.15);
}
@keyframes m-row-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.m-evalstat { color: #888; font-size: 0.8rem; font-style: italic; margin: -0.25rem 0 0.75rem; }
@media (max-width: 540px) {
  .m-row {
    grid-template-columns: 1fr;
    grid-template-areas: "head" "specs" "margins" "price" "cta";
  }
}
.m-row-head { grid-area: head; display: flex; gap: 0.5rem; align-items: baseline; }
.m-row-name { font-weight: 600; font-size: 1rem; }
.m-row-family { color: #888; font-size: 0.85rem; }
.m-row-specs { grid-area: specs; color: #444; font-size: 0.85rem; display: flex; flex-wrap: wrap; gap: 0.85rem; }
.m-row-specs span:not(:last-child)::after { content: "\00B7"; margin-left: 0.85rem; color: #aaa; }
.m-row-margins { grid-area: margins; color: #777; font-size: 0.8rem; }
.m-row-price { grid-area: price; font-size: 0.9rem; margin-top: 0.25rem; }
.m-pricerange { color: #1a1a1a; font-weight: 500; }
.m-pricesparse { color: #1a1a1a; font-weight: 500; }
.m-pricemedian { color: #777; font-size: 0.8rem; font-weight: 400; }
.m-pricemissing { color: #8a6d3b; font-style: italic; font-size: 0.85rem; }
.m-row-ctas {
  grid-area: cta;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 175px;
}
.m-row-cta {
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  background: #2a4d6e;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
}
.m-row-cta:hover { background: #1d3a55; }
.m-row-cta-range { background: #4a7ba8; }
.m-row-cta-range:hover { background: #36668f; }

.m-disqualified { margin-top: 1rem; color: #666; font-size: 0.9rem; }
.m-disqualified summary { cursor: pointer; padding: 0.5rem 0; }
.m-disqualified ul { margin: 0.5rem 0 0; padding-left: 1.5rem; }
