/* Pocket Austin — Unified Editorial Cartographic Chrome (Desktop)
 * Keeps >92% of the viewport pure illustrated Austin at rest while making
 * every feature one calm click away in disciplined, non-overlapping menus.
 * Scoped strictly to desktop (> 760px); mobile_ui.css owns <= 760px.
 */

@media (min-width: 761px) {
  /* ------------------------------------------------------------------
   * 1. TOP-LEFT: Compact Brand + Weather + Layers Toggle Pill (#hud)
   * ------------------------------------------------------------------ */
  #hud {
    top: 12px;
    left: 14px;
    width: fit-content;
    min-width: 0;
    max-width: calc(100vw - 560px);
    padding: 7px 11px;
    border-radius: 12px;
    background: rgba(251, 246, 234, 0.93);
    box-shadow: 0 4px 18px rgba(20, 15, 10, 0.18);
    transition: padding 0.18s ease, box-shadow 0.18s ease;
  }

  #hud:not(.collapsed) {
    width: 348px;
    max-width: 368px;
    padding: 11px 13px;
    max-height: calc(100vh - 74px);
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 10px 30px rgba(20, 15, 10, 0.28);
  }

  #hud.collapsed {
    width: fit-content;
    padding: 6px 8px 6px 13px;
    border-radius: 999px;
  }

  #hud header {
    gap: 8px;
    flex-wrap: nowrap;
  }

  #hud .hud-header-right {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }

  #hud h1 {
    font-size: 15px;
    letter-spacing: -0.02em;
    white-space: nowrap;
    flex-shrink: 0;
  }

  #hud #hud-toggle {
    width: auto !important;
    min-width: 68px;
    height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    gap: 4px;
    white-space: nowrap;
  }

  #hud:not(.collapsed) #hud-toggle {
    background: var(--ink, #2c221a);
    color: #fbf6ea;
    border-color: var(--ink, #2c221a);
  }

  /* Remove redundant Dusk button inside #hud (Solar Cycle bar already owns it) */
  #hud #btn-dusk {
    display: none !important;
  }

  /* ------------------------------------------------------------------
   * 2. TOP-RIGHT: One Single Calm Command Bar (#bookmarks -> unified bar)
   * ------------------------------------------------------------------ */
  #bookmarks {
    top: 12px !important;
    right: 14px !important;
    left: auto !important;
    max-width: calc(100vw - 360px) !important;
    padding: 4px 6px !important;
    border-radius: 999px !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 4px !important;
    background: rgba(251, 246, 234, 0.94) !important;
    box-shadow: 0 4px 18px rgba(20, 15, 10, 0.18) !important;
    z-index: 38 !important;
  }

  #bookmarks #search-wrap {
    width: 196px;
    transition: width 0.2s ease;
    margin: 0;
  }

  #bookmarks #search-wrap:focus-within {
    width: 248px;
  }

  #bookmarks #search-input {
    height: 30px;
    padding: 0 11px;
    border-radius: 999px;
    font-size: 12px;
    background: rgba(255, 253, 247, 0.95);
    border: 1.1px solid rgba(74, 59, 44, 0.34);
  }

  #bookmarks #search-results {
    top: calc(100% + 10px);
    left: 0;
    width: 310px;
    border-radius: 12px;
  }

  /* Hide the 4-row neighborhood chip wall from the bar itself (moved into Places popover) */
  #bookmarks #neighborhood-chips {
    display: none;
  }

  #bookmarks #neighborhood-chips.pa-places-open {
    display: flex !important;
    flex-wrap: wrap;
    gap: 5px;
    position: fixed;
    top: 62px;
    right: 14px;
    width: 372px;
    max-width: calc(100vw - 28px);
    max-height: 62vh;
    overflow-y: auto;
    padding: 12px;
    background: rgba(251, 246, 234, 0.97);
    border: 1.5px solid var(--border, #4a3b2c);
    border-radius: 14px;
    box-shadow: 0 14px 36px rgba(20, 15, 10, 0.28);
    backdrop-filter: blur(12px);
    z-index: 41;
    animation: paMenuSlideIn 0.14s ease-out;
  }

  #bookmarks #neighborhood-chips.pa-places-open::before {
    content: "JUMP TO AUSTIN NEIGHBORHOOD";
    flex: 1 0 100%;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.09em;
    color: var(--ink-muted, #665848);
    margin-bottom: 3px;
  }

  #bookmarks #neighborhood-chips.pa-places-open .pill {
    padding: 5px 10px;
    font-size: 11.5px;
    border-radius: 999px;
  }

  /* Command bar divider & clean buttons */
  .pa-cmd-sep {
    width: 1px;
    height: 18px;
    background: rgba(74, 59, 44, 0.2);
    margin: 0 2px;
    flex-shrink: 0;
  }

  .pa-cmd-btn {
    appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink, #2c221a);
    font-family: inherit;
    font-size: 11.8px;
    font-weight: 700;
    height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
  }

  .pa-cmd-btn:hover {
    background: rgba(74, 59, 44, 0.09);
  }

  .pa-cmd-btn.open,
  .pa-cmd-btn.active {
    background: var(--ink, #2c221a);
    color: #fbf6ea;
  }

  .pa-cmd-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent, #c45735);
    display: none;
    flex-shrink: 0;
  }

  .pa-cmd-btn.has-active .pa-cmd-dot {
    display: inline-block;
  }

  .pa-cmd-caret {
    font-size: 9px;
    opacity: 0.65;
  }

  /* Tuck the raw 7-pill plugin dock out of sight on desktop (buttons remain DOM-live for API/shortcuts) */
  #pa-explore-dock {
    position: fixed !important;
    top: 12px !important;
    right: 14px !important;
    height: 42px !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    overflow: hidden !important;
    max-width: 1px !important;
  }

  /* ------------------------------------------------------------------
   * 3. UNIFIED TOP-RIGHT POPOVER ANCHOR (Explore, Tools, Solar, Plugins)
   * ------------------------------------------------------------------ */
  .pa-cmd-menu {
    display: none;
    position: fixed;
    top: 62px;
    right: 14px;
    width: 286px;
    max-width: calc(100vw - 28px);
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    padding: 8px;
    background: rgba(251, 246, 234, 0.97);
    border: 1.5px solid var(--border, #4a3b2c);
    border-radius: 14px;
    box-shadow: 0 14px 36px rgba(20, 15, 10, 0.28);
    backdrop-filter: blur(12px);
    z-index: 41;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
    color: var(--ink, #2c221a);
  }

  .pa-cmd-menu.open {
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: paMenuSlideIn 0.14s ease-out;
  }

  @keyframes paMenuSlideIn {
    from {
      opacity: 0;
      transform: translateY(-5px) scale(0.985);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }

  .pa-menu-section {
    font-size: 9.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--ink-muted, #665848);
    padding: 5px 8px 2px;
  }

  .pa-menu-sep {
    height: 1px;
    background: rgba(74, 59, 44, 0.14);
    margin: 4px 4px;
  }

  .pa-menu-item {
    appearance: none;
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink, #2c221a);
    font-family: inherit;
    text-align: left;
    padding: 7px 9px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
  }

  .pa-menu-item:hover {
    background: rgba(74, 59, 44, 0.08);
  }

  .pa-menu-item.active {
    background: rgba(196, 87, 53, 0.13);
    border-color: rgba(196, 87, 53, 0.45);
  }

  .pa-mi-left {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
  }

  .pa-mi-ico {
    width: 20px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
  }

  .pa-mi-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .pa-mi-title {
    font-size: 12.2px;
    font-weight: 700;
    line-height: 1.2;
  }

  .pa-mi-sub {
    font-size: 10.2px;
    color: var(--ink-muted, #665848);
    line-height: 1.25;
  }

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

  .pa-mi-pill {
    font-size: 9.8px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(74, 59, 44, 0.1);
    color: var(--ink, #2c221a);
  }

  .pa-menu-item.active .pa-mi-pill {
    background: var(--accent, #c45735);
    color: #fbf6ea;
  }

  /* Compact inline segmented chips inside Tools / Solar menus */
  .pa-seg-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 3px;
    padding: 3px 4px 4px;
  }

  .pa-seg-chip {
    appearance: none;
    border: 1px solid rgba(74, 59, 44, 0.25);
    background: rgba(255, 251, 242, 0.85);
    color: var(--ink, #2c221a);
    font-family: inherit;
    font-size: 10.2px;
    font-weight: 700;
    padding: 5px 2px;
    border-radius: 7px;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
  }

  .pa-seg-chip:hover {
    background: rgba(74, 59, 44, 0.1);
  }

  .pa-seg-chip.active {
    background: var(--ink, #2c221a);
    border-color: var(--ink, #2c221a);
    color: #fbf6ea;
  }

  /* Normalize all plugin drawers so they open cleanly right under the 42px top bar */
  #pa-explore-drawer,
  #pa-tours-menu,
  #pa-hunt-drawer,
  #pa-sound-popover {
    top: 62px !important;
    right: 14px !important;
    max-height: calc(100vh - 130px) !important;
    z-index: 40 !important;
  }

  /* ------------------------------------------------------------------
   * 4. BOTTOM-CENTER TOASTS (never collide with top search bar!)
   * ------------------------------------------------------------------ */
  #pa-hunt-toast {
    top: auto !important;
    bottom: 44px !important;
    left: 50% !important;
    transform: translateX(-50%) translateY(10px) !important;
    z-index: 44 !important;
  }

  #pa-hunt-toast.visible {
    transform: translateX(-50%) translateY(0) !important;
  }

  /* ------------------------------------------------------------------
   * 5. BOTTOM-RIGHT: Calm Navigation Stack (Mini-map collapsed by default)
   * ------------------------------------------------------------------ */
  #pa-minimap {
    right: 14px !important;
    bottom: 136px !important;
  }

  #pa-minimap.collapsed {
    bottom: 132px !important;
  }

  /* Ensure Inspector at bottom-left is crisp and never collides with footer */
  #inspector {
    bottom: 34px !important;
    left: 14px !important;
    max-height: calc(100vh - 110px) !important;
    overflow-y: auto !important;
    z-index: 36 !important;
  }

  /* Subtle floating active-mode pill when Measure / Drop Pin is active */
  #pa-measure-card {
    bottom: 34px !important;
    z-index: 37 !important;
  }
}
