/* Pitch — Apple design system over a full-bleed 3D scene.
   SF system stack, dark vibrancy materials, hairline separators,
   continuous-corner radii, iOS system blue accent. */

:root {
  --blue: #0a84ff;
  --green: #30d158;
  --orange: #ff9f0a;
  --red: #ff453a;
  --label: rgba(255, 255, 255, 0.96);
  --label-2: rgba(235, 235, 245, 0.62);
  --label-3: rgba(235, 235, 245, 0.32);
  --separator: rgba(255, 255, 255, 0.10);
  --material: rgba(28, 28, 30, 0.68);
  --material-thick: rgba(28, 28, 30, 0.82);
  --fill: rgba(120, 120, 128, 0.24);
  --fill-hover: rgba(120, 120, 128, 0.36);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
          "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  background: #000;
  font-family: var(--font);
  color: var(--label);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

#cesium { position: fixed; inset: 0; }
#cesium .cesium-viewer-bottom { opacity: 0.75; }
#cesium.drawing canvas { cursor: crosshair; }
#cesium.closing canvas { cursor: pointer; }

/* ---------- glass material ---------- */
.glass {
  background: var(--material);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 0.5px solid var(--separator);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.38);
}

/* ---------- top island ---------- */
.island {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 8px 10px 8px 16px;
  border-radius: 22px;
  background: var(--material);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 0.5px solid var(--separator);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.38);
  max-width: min(900px, calc(100vw - 24px));
}

.brand {
  display: flex; align-items: center; gap: 7px;
  font-size: 15px; font-weight: 600; letter-spacing: -0.2px;
  color: var(--label);
}
.brand svg { color: var(--blue); }

.search {
  display: flex; align-items: center; gap: 8px;
  flex: 1; min-width: 300px;
  background: var(--fill);
  border-radius: 12px;
  padding: 0 4px 0 10px;
  height: 34px;
  transition: box-shadow 0.15s ease;
}
.search:focus-within { box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.35); }
.search-icon { color: var(--label-2); flex: none; }

#address {
  flex: 1; min-width: 0;
  background: none; border: none; outline: none;
  color: var(--label);
  font: 400 14px/1 var(--font);
}
#address::placeholder { color: var(--label-3); }

.go {
  border: none; cursor: pointer;
  background: var(--blue); color: #fff;
  font: 600 13px/1 var(--font);
  padding: 7px 13px; border-radius: 9px;
  transition: filter 0.15s ease, transform 0.1s ease;
}
.go:hover { filter: brightness(1.12); }
.go:active { transform: scale(0.96); }

.tools { display: flex; gap: 8px; }

.tool {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; cursor: pointer;
  background: var(--fill); color: var(--label);
  font: 600 13px/1 var(--font);
  padding: 0 13px; height: 34px; border-radius: 12px;
  transition: background 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}
.tool:hover:not(:disabled) { background: var(--fill-hover); }
.tool:active:not(:disabled) { transform: scale(0.96); }
.tool:disabled { opacity: 0.35; cursor: default; }
.tool.active { background: var(--blue); }
.tool.subtle { color: var(--label-2); }

/* Solar-only toggle — pill checkbox matching the tool buttons. */
.toggle {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 12px; border-radius: 12px;
  background: var(--fill); cursor: pointer;
  font: 600 13px/1 var(--font); color: var(--label-2);
  white-space: nowrap; user-select: none;
  transition: background 0.15s ease;
}
.toggle:hover { background: var(--fill-hover); }
.toggle input, .welcome-toggle input {
  appearance: none; -webkit-appearance: none; margin: 0;
  width: 16px; height: 16px; border-radius: 5px;
  border: 1.5px solid var(--label-3); background: transparent;
  display: grid; place-content: center; cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.toggle input:checked, .welcome-toggle input:checked {
  background: var(--blue); border-color: var(--blue);
}
.toggle input:checked::after, .welcome-toggle input:checked::after {
  content: ""; width: 9px; height: 9px;
  background: #fff;
  clip-path: polygon(14% 47%, 0 61%, 40% 100%, 100% 22%, 86% 8%, 40% 72%);
}
.toggle:has(input:checked) { color: var(--label); }

button:focus-visible, input:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 2px;
}

/* ---------- hint pill ---------- */
.hint {
  position: fixed; top: 76px; left: 50%; transform: translateX(-50%);
  z-index: 19;
  padding: 8px 16px; border-radius: 999px;
  background: var(--material);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 0.5px solid var(--separator);
  font-size: 12.5px; color: var(--label-2);
  animation: rise 0.25s ease;
}
.hint kbd {
  font-family: var(--font); font-size: 11px;
  background: var(--fill); border-radius: 5px; padding: 2px 5px;
  color: var(--label);
}

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 30;
  padding: 11px 18px; border-radius: 999px;
  background: var(--material-thick);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 0.5px solid var(--separator);
  font-size: 13.5px; font-weight: 500;
  animation: rise 0.25s ease;
  max-width: min(560px, calc(100vw - 32px));
  text-align: center;
}
.toast.error { color: var(--red); }
.toast.busy::before {
  content: ""; display: inline-block; vertical-align: -2px;
  width: 12px; height: 12px; margin-right: 9px;
  border: 2px solid var(--label-3); border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); }
                  to   { opacity: 1; transform: translate(-50%, 0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- results panel ---------- */
.panel {
  position: fixed; top: 76px; left: 14px; bottom: 14px;
  z-index: 18;
  width: 308px;
  display: flex; flex-direction: column;
  border-radius: var(--radius);
  background: var(--material);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 0.5px solid var(--separator);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.38);
  overflow: hidden;
  animation: slide 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes slide { from { opacity: 0; transform: translateX(-16px); }
                   to   { opacity: 1; transform: none; } }

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 0.5px solid var(--separator);
}
.panel-head h2 {
  margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.3px;
}
.count {
  min-width: 22px; height: 22px; padding: 0 7px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--fill); border-radius: 999px;
  font-size: 12px; font-weight: 600; color: var(--label-2);
}

.face-list { overflow-y: auto; padding: 10px; display: grid; gap: 10px; }
.face-list::-webkit-scrollbar { width: 0; }

/* face card — widget style */
.face-card {
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
  border: 0.5px solid var(--separator);
  padding: 12px 14px;
  display: grid; gap: 9px;
  animation: rise 0.25s ease;
}

.face-top { display: flex; align-items: center; gap: 9px; }
.swatch { width: 11px; height: 11px; border-radius: 4px; flex: none; }
.face-name { font-size: 13px; font-weight: 600; flex: 1; }
.face-del {
  border: none; background: none; cursor: pointer;
  color: var(--label-3); font-size: 16px; line-height: 1; padding: 2px 4px;
  border-radius: 6px;
}
.face-del:hover { color: var(--red); background: var(--fill); }

.pitch-row { display: flex; align-items: baseline; gap: 12px; }
.pitch-big {
  font-size: 34px; font-weight: 800; letter-spacing: -1.5px;
  font-variant-numeric: tabular-nums;
}
.pitch-big small { font-size: 19px; font-weight: 600; color: var(--label-2); }
.pitch-angle { font-size: 13px; color: var(--label-2); font-weight: 500; }

.metrics {
  display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px;
  font-size: 12px;
}
.metrics dt { color: var(--label-3); }
.metrics dd { margin: 0; color: var(--label-2); font-weight: 500; text-align: right;
              font-variant-numeric: tabular-nums; }
.metric { display: flex; justify-content: space-between; gap: 8px; }

.face-warn { font-size: 11.5px; color: var(--orange); }

.quality-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; color: var(--label-2);
}
.quality-pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.dot.good { background: var(--green); }
.dot.ok   { background: var(--orange); }
.dot.bad  { background: var(--red); }

/* ---------- pan + zoom controls ---------- */
.nav-controls {
  position: fixed; right: 16px; bottom: 30px; z-index: 19;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
body.start .nav-controls { display: none; }

.nav-controls .glass { border-radius: 12px; overflow: hidden; }
.nav-controls button {
  border: none; cursor: pointer;
  background: transparent; color: var(--label);
  font: 500 15px/1 var(--font);
  display: grid; place-items: center;
  transition: background 0.12s ease;
}
.nav-controls button:hover { background: var(--fill-hover); }
.nav-controls button:active { background: var(--blue); }

.pan-pad {
  display: grid;
  grid-template-columns: repeat(3, 32px);
  grid-template-rows: repeat(3, 32px);
}
.pan-pad button { font-size: 11px; color: var(--label-2); }
.pan-pad button[data-pan="up"]    { grid-area: 1 / 2; }
.pan-pad button[data-pan="left"]  { grid-area: 2 / 1; }
.pan-pad button[data-pan="right"] { grid-area: 2 / 3; }
.pan-pad button[data-pan="down"]  { grid-area: 3 / 2; }

.zoom-pad { display: flex; flex-direction: column; }
.zoom-pad button { width: 40px; height: 38px; font-size: 20px; font-weight: 400; }
.zoom-pad button:first-child { border-bottom: 0.5px solid var(--separator); }

.rotate-pad {
  display: flex; align-items: center; gap: 7px;
  padding: 0 10px; height: 34px; width: 132px;
  color: var(--label-2);
}
.rotate-pad input[type="range"] {
  -webkit-appearance: none; appearance: none;
  flex: 1; height: 3px; border-radius: 3px; margin: 0;
  background: var(--fill-hover); cursor: pointer;
}
.rotate-pad input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--blue); border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.rotate-pad input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--blue); border: 2px solid #fff;
}

/* ---------- welcome ---------- */
.welcome {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 34%,
              rgba(10, 132, 255, 0.16), transparent 58%), #0a0a0c;
  transition: opacity 0.5s ease;
}
.welcome.gone { opacity: 0; pointer-events: none; }
.welcome-card {
  text-align: center; max-width: 640px; width: 100%; padding: 0 24px;
  transform: translateY(-12vh);      /* sit higher up, not dead-centre */
}

/* Google-style start-screen search box */
.welcome-search {
  display: flex; align-items: center; gap: 10px;
  margin-top: 26px;
  background: var(--fill);
  border: 0.5px solid var(--separator);
  border-radius: 14px;
  padding: 0 6px 0 14px; height: 52px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  transition: box-shadow 0.15s ease;
}
.welcome-search:focus-within { box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.4); }
.welcome-search .search-icon { color: var(--label-2); flex: none; }
.welcome-search input {
  flex: 1; min-width: 0; background: none; border: none; outline: none;
  color: var(--label); font: 400 16px/1 var(--font);
}
.welcome-search input::placeholder { color: var(--label-3); }
.welcome-search .go { height: 40px; padding: 0 18px; font-size: 14px; border-radius: 10px; }

.welcome-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 16px; cursor: pointer; user-select: none;
  font: 500 13px/1 var(--font); color: var(--label-2);
}
.welcome-toggle:has(input:checked) { color: var(--label); }

/* Hide the map chrome until the first search happens */
body.start .island,
body.start .hint { display: none; }

/* Google Places autocomplete dropdown, themed to match */
.pac-container {
  z-index: 60;                       /* above the start overlay */
  min-width: 340px;                  /* readable even off the narrow top-bar input */
  margin-top: 6px;
  background: var(--material-thick);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 0.5px solid var(--separator);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  font-family: var(--font);
  overflow: hidden;
}
.pac-item {
  border-top: 0.5px solid var(--separator);
  padding: 8px 12px; color: var(--label-2); font-size: 13px; cursor: pointer;
}
.pac-item:hover, .pac-item-selected { background: var(--fill); }
.pac-item-query { color: var(--label); font-size: 14px; }
.pac-matched { color: var(--label); }   /* matched text white, not blue */
.pac-icon { display: none; }
.welcome-glyph { color: var(--blue); margin-bottom: 14px; }
.welcome h1 {
  margin: 0 0 10px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", var(--font);
  font-size: 32px; font-weight: 800; letter-spacing: -1px;
}
.welcome p { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--label-2); }

/* face label on the 3D scene handled by Cesium labels */

@media (max-width: 700px) {
  .island { flex-wrap: wrap; border-radius: 18px; }
  .brand span { display: none; }
  .panel { left: 14px; width: auto; top: auto; max-height: 46vh; }
}

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