/* ui/MoreMenu — the menu's overflow. Contract: ./MoreMenu.spec.md
   menu: a dropdown under ui/CommandDeck's ☰; sheet: a phone's bottom sheet. */

.sp-more { position: fixed; inset: 0; z-index: 40; }
.sp-more__scrim { position: absolute; inset: 0; background: transparent; }
/* The dropdown dims the menu behind it: a layer over the page, never read as one of its cards. */
.sp-more[data-variant="menu"] .sp-more__scrim {
  background: color-mix(in srgb, var(--sp-space-0) 45%, transparent);
  animation: sp-more-fade 160ms var(--sp-ease-out);
}
.sp-more[data-variant="sheet"] .sp-more__scrim {
  background: color-mix(in srgb, var(--sp-space-0) 70%, transparent);
  animation: sp-more-fade 220ms var(--sp-ease-out);
}

.sp-more__panel {
  position: absolute; display: flex; flex-direction: column; overflow: auto;
  background: var(--sp-glass); border: 1px solid var(--sp-line); backdrop-filter: blur(8px);
  color: var(--sp-text);
}
/* The dropdown: under the ☰ at the top right. */
.sp-more[data-variant="menu"] .sp-more__panel {
  top: calc(56px + 4px + env(safe-area-inset-top)); right: calc(16px + env(safe-area-inset-right));
  min-width: 240px; max-height: calc(100vh - 76px); padding: 6px 0 0;
  border-radius: var(--sp-radius);
  box-shadow: 0 18px 48px color-mix(in srgb, var(--sp-seam) 85%, transparent);
  animation: sp-more-drop 160ms var(--sp-ease-out);
}
/* The bottom sheet. */
.sp-more[data-variant="sheet"] .sp-more__panel {
  left: 0; right: 0; bottom: 0; max-height: 85vh;
  padding: 8px env(safe-area-inset-right) calc(8px + env(safe-area-inset-bottom)) env(safe-area-inset-left);
  border-width: 1px 0 0; border-radius: var(--sp-radius) var(--sp-radius) 0 0;
  animation: sp-more-rise 220ms var(--sp-ease-out); transition: transform 160ms var(--sp-ease-out);
}

.sp-more__handle { display: flex; justify-content: center; padding: 6px 0 10px; touch-action: none; cursor: grab; }
.sp-more__handle i { width: 36px; height: 4px; border-radius: 2px; background: var(--sp-line-strong); }
.sp-more__close {
  position: absolute; top: 8px; right: calc(8px + env(safe-area-inset-right)); width: 44px; height: 44px; min-width: 44px; min-height: 44px;
  border: 0; background: none; color: var(--sp-text-dim); font-size: 16px; cursor: pointer;
}

.sp-more__items { display: flex; flex-direction: column; }
.sp-more__item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 20px;
  border: 0; background: none; color: var(--sp-text-dim); cursor: pointer; text-align: left;
  font-family: var(--sp-font-display); font-weight: 600; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase;
}
.sp-more__item:hover, .sp-more__item:focus-visible { color: var(--sp-text); background: color-mix(in srgb, var(--sp-text) 6%, transparent); }
.sp-more[data-variant="sheet"] .sp-more__item { min-height: 48px; padding: 0 24px; font-size: 14px; }
.sp-more__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--sp-accent-2); box-shadow: 0 0 6px var(--sp-accent-2); }

.sp-more__footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px;
  margin-top: 6px; padding: 10px 20px 12px; border-top: 1px solid var(--sp-line);
  font-size: 12px; color: var(--sp-text-faint);
}
.sp-more__legal { display: inline-flex; gap: 12px; }
.sp-more__legal-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--sp-text-dim); text-decoration: none; }
.sp-more__legal-link:hover, .sp-more__legal-link:focus-visible { color: var(--sp-text); text-decoration: underline; }

@keyframes sp-more-drop { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sp-more-rise { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sp-more-fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .sp-more__panel, .sp-more__scrim { animation: none !important; transition: none !important; }
}

/* Thumbs: a short link ("Terms") still takes a 44 px square (§1.11 rule 1). */
@media (pointer: coarse) {
  .sp-more__legal-link { min-width: 44px; justify-content: center; }
}
