/* Pocket Austin — Track 3.8: Interactive Survey Ruler, Custom "My Austin" Pins & Skyline Height Comparator
 * Warm ligne claire parchment & sepia ink styling matching viewer/index.html
 */

/* Ensure shared top-right dock never overflows horizontally on narrow viewports */
#pa-explore-dock {
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: calc(100vw - 28px);
}

/* Active mode states for Measure & Drop Pin dock buttons */
#pa-measure-btn.is-active,
#pa-pin-btn.is-active {
  background: #c45735;
  color: #fbf6ea;
  border-color: #2c221a;
  box-shadow: 0 4px 16px rgba(196, 87, 53, 0.36);
}

#pa-measure-btn.is-active:hover,
#pa-pin-btn.is-active:hover {
  background: #b14a2a;
}

#pa-pin-btn .pa-pin-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: #c45735;
  color: #fbf6ea;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

#pa-pin-btn.is-active .pa-pin-count {
  background: rgba(251, 246, 234, 0.25);
  color: #fbf6ea;
}

#pa-pin-btn .pa-pin-count.hidden {
  display: none;
}

/* Crosshair cursor override while Measure or Pin Drop mode is active */
body.pa-mode-measure #map,
body.pa-mode-measure #map canvas,
body.pa-mode-pin #map,
body.pa-mode-pin #map canvas {
  cursor: crosshair !important;
}

/* ============================================================
 * 1. Floating Parchment Survey Ruler Readout Card
 * ============================================================ */
#pa-measure-card {
  position: fixed;
  bottom: 42px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  display: none;
  flex-direction: column;
  gap: 8px;
  width: max-content;
  min-width: 320px;
  max-width: calc(100vw - 28px);
  padding: 10px 14px 11px;
  background: rgba(251, 246, 234, 0.96);
  border: 1.5px solid #4a3b2c;
  border-radius: 11px;
  box-shadow: 0 10px 28px rgba(20, 15, 10, 0.32);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #2c221a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  box-sizing: border-box;
}

#pa-measure-card.visible {
  display: flex;
  animation: paExploreFadeUp 0.16s ease-out;
}

@keyframes paExploreFadeUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.pa-mc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pa-mc-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.pa-mc-kicker {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #c45735;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(196, 87, 53, 0.12);
  border: 1px solid rgba(196, 87, 53, 0.32);
  white-space: nowrap;
}

.pa-mc-distance {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 700;
  color: #2c221a;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.pa-mc-metric {
  font-size: 11px;
  font-weight: 600;
  color: #665848;
  white-space: nowrap;
}

.pa-mc-hint {
  font-size: 12px;
  color: #665848;
  line-height: 1.3;
}

.pa-mc-controls {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.pa-mc-btn {
  appearance: none;
  border: 1.2px solid rgba(74, 59, 44, 0.52);
  background: #fffaf0;
  color: #2c221a;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.14s ease, border-color 0.14s ease, opacity 0.14s ease;
}

.pa-mc-btn:hover:not(:disabled) {
  background: #efe5cf;
  border-color: #2c221a;
}

.pa-mc-btn:disabled {
  opacity: 0.42;
  cursor: default;
}

.pa-mc-btn.danger:hover:not(:disabled) {
  border-color: #c45735;
  color: #a63d20;
}

.pa-mc-close {
  appearance: none;
  border: none;
  background: none;
  color: #665848;
  font-size: 18px;
  line-height: 1;
  padding: 1px 4px;
  cursor: pointer;
}

.pa-mc-close:hover {
  color: #2c221a;
}

.pa-mc-modes {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px dashed rgba(74, 59, 44, 0.24);
}

.pa-mc-modes.hidden {
  display: none;
}

.pa-mc-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(74, 59, 44, 0.075);
  border: 1px solid rgba(74, 59, 44, 0.18);
  font-size: 11px;
  font-weight: 600;
  color: #2c221a;
  white-space: nowrap;
}

.pa-mc-chip strong {
  font-weight: 800;
  color: #9e3d1f;
}

/* ============================================================
 * 2. Custom "My Austin" Pin Creation Popover & Inspector Strip
 * ============================================================ */
#pa-pin-popover {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 48;
  display: none;
  flex-direction: column;
  gap: 8px;
  width: 288px;
  max-width: calc(100vw - 24px);
  padding: 11px 13px 12px;
  background: rgba(251, 246, 234, 0.98);
  border: 1.5px solid #4a3b2c;
  border-radius: 11px;
  box-shadow: 0 12px 32px rgba(20, 15, 10, 0.34);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #2c221a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  box-sizing: border-box;
}

#pa-pin-popover.open {
  display: flex;
  animation: paPinPopIn 0.15s ease-out;
}

@keyframes paPinPopIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.pa-pin-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pa-pin-pop-title {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14.5px;
  font-weight: 700;
  color: #2c221a;
}

.pa-pin-pop-close {
  appearance: none;
  border: none;
  background: none;
  color: #665848;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.pa-pin-pop-close:hover {
  color: #2c221a;
}

.pa-emoji-row {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
}

.pa-emoji-btn {
  appearance: none;
  border: 1.2px solid rgba(74, 59, 44, 0.24);
  background: rgba(255, 252, 245, 0.85);
  border-radius: 7px;
  height: 30px;
  padding: 0;
  font-size: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.1s ease;
}

.pa-emoji-btn:hover {
  background: #f2e8d2;
  transform: translateY(-1px);
}

.pa-emoji-btn.selected {
  background: rgba(196, 87, 53, 0.18);
  border-color: #c45735;
  box-shadow: inset 0 0 0 1px #c45735;
}

.pa-pin-field {
  width: 100%;
  border: 1.2px solid rgba(74, 59, 44, 0.48);
  border-radius: 7px;
  background: #fffdf8;
  color: #2c221a;
  font-family: inherit;
  font-size: 12.2px;
  padding: 6px 8px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.pa-pin-field:focus {
  border-color: #c45735;
  box-shadow: 0 0 0 2px rgba(196, 87, 53, 0.16);
}

textarea.pa-pin-field {
  resize: none;
  line-height: 1.35;
  min-height: 50px;
}

.pa-pin-pop-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 2px;
}

.pa-pin-save-btn {
  appearance: none;
  border: 1.2px solid #2c221a;
  background: #c45735;
  color: #fbf6ea;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.14s ease;
}

.pa-pin-save-btn:hover {
  background: #ad4627;
}

/* Pin actions inside #inspector (#insp-extra) */
.pa-pin-insp-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px dashed rgba(74, 59, 44, 0.24);
}

.pa-pin-insp-btn {
  appearance: none;
  border: 1.2px solid #4a3b2c;
  background: #fffaf0;
  color: #2c221a;
  font-family: inherit;
  font-size: 11.2px;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.pa-pin-insp-btn:hover {
  background: #efe5cf;
}

.pa-pin-insp-btn.primary {
  background: #c45735;
  border-color: #2c221a;
  color: #fbf6ea;
}

.pa-pin-insp-btn.primary:hover {
  background: #ad4627;
}

.pa-pin-insp-btn.danger {
  color: #9e331c;
  border-color: rgba(158, 51, 28, 0.45);
}

.pa-pin-insp-btn.danger:hover {
  background: rgba(196, 87, 53, 0.14);
  border-color: #c45735;
}

/* ============================================================
 * 3. Architectural Skyline Height Comparator inside #inspector
 * ============================================================ */
.pa-skyline-cmp {
  margin-top: 9px;
  padding: 8px 9px 7px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 252, 245, 0.85), rgba(243, 234, 214, 0.72));
  border: 1.2px solid rgba(74, 59, 44, 0.30);
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
}

.pa-sky-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.pa-sky-title {
  font-size: 9.8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #4a3b2c;
}

.pa-sky-rank {
  font-size: 10px;
  font-weight: 700;
  color: #fbf6ea;
  background: #c45735;
  border: 1px solid #2c221a;
  padding: 1.5px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.pa-sky-chart {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  align-items: end;
  gap: 4px;
  height: 98px;
  padding: 4px 2px 0;
  border-bottom: 1.5px solid #4a3b2c;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 23px,
      rgba(74, 59, 44, 0.09) 23px,
      rgba(74, 59, 44, 0.09) 24px
    );
}

.pa-sky-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
}

.pa-sky-ft {
  font-size: 8.8px;
  font-weight: 700;
  color: #665848;
  line-height: 1.1;
  margin-bottom: 2px;
  white-space: nowrap;
}

.pa-sky-col.is-selected .pa-sky-ft {
  color: #b54523;
  font-weight: 800;
}

.pa-sky-bar-wrap {
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 6px;
}

.pa-sky-svg {
  display: block;
  width: 100%;
  max-width: 28px;
  overflow: visible;
}

.pa-sky-labels {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 4px;
  padding: 4px 2px 0;
}

.pa-sky-lbl {
  font-size: 8.8px;
  font-weight: 600;
  color: #665848;
  text-align: center;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pa-sky-lbl.is-selected {
  color: #c45735;
  font-weight: 800;
}

/* ============================================================
 * Mobile Responsive Rules (Zero Horizontal Overflow <= 760px)
 * ============================================================ */
@media (max-width: 760px) {
  #pa-measure-card {
    left: 10px;
    right: 10px;
    bottom: 126px;
    width: auto;
    min-width: 0;
    max-width: calc(100vw - 20px);
    transform: none;
    padding: 9px 11px;
  }

  #pa-measure-card.visible {
    animation: paExploreFadeUpMobile 0.16s ease-out;
  }

  @keyframes paExploreFadeUpMobile {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  body.pa-mobile-active #pa-measure-card {
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + 56px);
  }

  .pa-mc-top {
    flex-wrap: wrap;
    gap: 6px;
  }

  .pa-mc-distance {
    font-size: 14.5px;
  }

  .pa-mc-modes {
    gap: 4px;
  }

  .pa-mc-chip {
    font-size: 10.5px;
    padding: 2.5px 7px;
  }

  #pa-pin-popover {
    width: min(296px, calc(100vw - 20px));
    max-width: calc(100vw - 20px);
  }

  .pa-sky-chart {
    height: 86px;
    gap: 3px;
  }

  .pa-sky-ft,
  .pa-sky-lbl {
    font-size: 8.2px;
  }
}
