.state-filters[hidden],
.project-list[hidden] {
  display: none !important;
}

/* Keep the capture surface calm when there is nothing waiting in the inbox. */
.capture-panel > .muted {
  display: none;
}

/* The filter row changes context from captured ideas back to projects. Give that
   transition a visible label without adding another interactive control. */
.state-filters::before {
  content: "Projects";
  flex: 0 0 100%;
  margin: .1rem 0 .2rem;
  color: #c4b5fd;
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* When a disclosure contains the currently focused action, keep its trigger
   visibly anchored so keyboard users do not lose context in compact menus. */
.utility-menu:focus-within > summary,
.project-actions-menu:focus-within > summary,
.advanced-fields:focus-within > summary,
.capture-inbox:focus-within > summary {
  outline: 3px solid #a78bfa;
  outline-offset: 2px;
}

/* Recovery is a core safety feature, so make it read like a deliberate workspace
   instead of a browser-default stack of paragraphs and buttons. */
dialog h2 {
  margin: 0 0 .35rem;
}

dialog h3 {
  margin: 1.2rem 0 .55rem;
  color: #c4b5fd;
  font-size: .82rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

dialog p {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: .5rem;
  align-items: center;
  margin: .5rem 0;
  padding: .7rem;
  border: 1px solid #30223e;
  border-radius: .75rem;
  background: #0d0913;
}

dialog [data-close] {
  position: sticky;
  bottom: 0;
  width: 100%;
  margin-top: 1rem;
  background: #181020;
}

@media (max-width: 720px) {
  html {
    scroll-padding-bottom: calc(5.6rem + env(safe-area-inset-bottom));
  }

  .mobile-dock {
    position: fixed !important;
    top: auto !important;
    left: max(.45rem, env(safe-area-inset-left));
    right: max(.45rem, env(safe-area-inset-right));
    bottom: max(.45rem, env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
    margin: 0 !important;
    z-index: 20 !important;
  }

  /* Brand-new users already have explicit project/capture choices in onboarding.
     Hiding the dock here removes redundant navigation and prevents it crowding
     the primary first-run action. It returns automatically once onboarding ends. */
  #app:has(.onboarding) .mobile-dock {
    display: none !important;
  }

  #app {
    padding-bottom: calc(4.7rem + env(safe-area-inset-bottom));
  }

  footer {
    padding-bottom: 1rem !important;
  }

  .footer-safety small {
    display: none;
  }

  /* On phones the accessible label already explains this control. Keep only the
     ellipsis glyph so the search field has enough room for its placeholder. */
  .utility-menu > summary {
    font-size: 0 !important;
    padding-inline: .65rem !important;
  }

  .utility-menu > summary::after {
    font-size: 1rem;
  }

  /* Keep focused fields readable without browser auto-zoom and give multiline
     editing enough vertical room above the fixed navigation dock. */
  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  .editor textarea {
    min-height: 7.5rem;
  }

  /* Compact desktop controls still need finger-sized targets on phones. */
  .capture-actions button,
  .project-actions-menu > summary,
  .capture-inbox > summary {
    min-height: 44px;
    touch-action: manipulation;
  }

  .capture-actions button {
    flex: 1 1 auto;
  }

  .mobile-dock button,
  .state-filter,
  .utility-menu > summary {
    touch-action: manipulation;
  }

  dialog {
    width: calc(100vw - 1rem);
    max-width: none;
    max-height: calc(100dvh - 1rem);
    padding: .9rem;
  }

  dialog p {
    grid-template-columns: 1fr;
  }

  dialog p button {
    width: 100%;
  }
}

/* Touch-capable tablets and large-screen devices should not lose the same target
   sizing merely because their CSS viewport is wider than the phone breakpoint. */
@media (pointer: coarse) {
  button,
  .file-button,
  summary {
    min-height: 44px;
  }

  button,
  .file-button,
  summary,
  .state-filter {
    touch-action: manipulation;
  }
}

/* Users asking for stronger contrast should not have to decode subtle purple
   borders to discover focus and interactive boundaries. */
@media (prefers-contrast: more) {
  .mobile-dock,
  .utility-menu > summary,
  .state-filter,
  .project-card,
  .editor,
  aside,
  dialog p {
    border-width: 2px !important;
  }

  button:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible,
  summary:focus-visible {
    outline-width: 4px !important;
    outline-offset: 3px !important;
  }
}

/* Respect OS high-contrast/forced-color palettes rather than preserving brand
   gradients at the cost of readable controls. */
@media (forced-colors: active) {
  .mobile-dock,
  .utility-menu-content,
  .project-action-content,
  dialog p {
    background: Canvas !important;
    color: CanvasText !important;
    border: 1px solid CanvasText !important;
    box-shadow: none !important;
  }

  .mobile-dock button[data-mobile="capture"],
  .state-filter[aria-pressed="true"] {
    background: Highlight !important;
    color: HighlightText !important;
    border-color: Highlight !important;
    box-shadow: none !important;
  }

  .xp-track > span {
    background: Highlight !important;
  }
}

/* Product/monetization strategy is not user-facing footer copy. */
.footer-safety small {
  display: none;
}
