/* keyboard-nav.css — Vim-style keyboard navigation */

/* --- CSS custom properties for scroll margin (matches navbar padding) --- */
/* Scroll margin matches navbar height: 48px on <=991px, 46px on >=992px */
:root { --dlc-scroll-margin: 48px; }
@media (min-width: 992px) { :root { --dlc-scroll-margin: 46px; } }

/* --- Focus ring on current card --- */
.dlc-card.dlc-kbd-focus {
  outline: 3px solid var(--app-color, #0071e3);
  outline-offset: 2px;
  scroll-margin-top: var(--dlc-scroll-margin);
}

/* --- sr-only (for aria-live region) --- */
.dlc-kbd-sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Help modal overlay --- */
.dlc-kbd-help-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 9998;
  display: flex; align-items: center; justify-content: center;
}
.dlc-kbd-help-overlay[hidden] { display: none; }

.dlc-kbd-help-modal {
  background: #fff;
  border-radius: 8px;
  max-width: 720px;
  width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, .3);
  color: #212529;
}

.dlc-kbd-help-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #e0e0e0;
}
.dlc-kbd-help-header h2 {
  font-size: 18px; margin: 0; font-weight: 600;
}

.dlc-kbd-help-body { padding: 0 16px 8px; }
.dlc-kbd-help-body section { margin-top: 12px; }
.dlc-kbd-help-body h3 {
  font-size: 14px; margin: 10px 0 4px; color: #555; font-weight: 600;
}
.dlc-kbd-help-body table { width: 100%; border-collapse: collapse; }
.dlc-kbd-help-body td { padding: 3px 4px; font-size: 13px; vertical-align: top; }
.dlc-kbd-help-body .dlc-kbd-cell { width: 140px; white-space: nowrap; }

.dlc-kbd-help-body kbd,
.dlc-kbd-hint kbd {
  background: #f5f5f5;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #212529;
}

.dlc-kbd-help-footer {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap;
  padding: 12px 16px;
  border-top: 1px solid #e0e0e0;
  font-size: 13px;
}
.dlc-kbd-help-footer label { margin: 0; cursor: pointer; }

.dlc-kbd-help-close {
  background: none; border: none; font-size: 24px; cursor: pointer;
  color: #999; line-height: 1; padding: 0 6px;
}
.dlc-kbd-help-close:hover { color: #333; }

/* --- Hint toast (first-visit) --- */
.dlc-kbd-hint {
  position: fixed;
  bottom: 16px; right: 16px;
  background: rgba(0, 0, 0, .88);
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  z-index: 9997;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
  animation: dlc-kbd-hint-slide-in .3s ease-out;
}
.dlc-kbd-hint kbd {
  background: #444; border-color: #666; color: #fff;
}
.dlc-kbd-hint-open,
.dlc-kbd-hint-close {
  background: none; border: none; color: #fff; cursor: pointer;
  padding: 2px 6px; font-size: 13px;
}
.dlc-kbd-hint-open { text-decoration: underline; }
.dlc-kbd-hint-close { font-size: 18px; }

@keyframes dlc-kbd-hint-slide-in {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  .dlc-kbd-hint { animation: none; }
}

/* --- Dark mode --- */
@media (prefers-color-scheme: dark) {
  .dlc-kbd-help-modal {
    background: #222; color: #eee;
  }
  .dlc-kbd-help-header, .dlc-kbd-help-footer {
    border-color: #444;
  }
  .dlc-kbd-help-body kbd {
    background: #333; border-color: #555; color: #eee;
  }
  .dlc-kbd-help-body h3 { color: #bbb; }
  .dlc-kbd-help-close { color: #bbb; }
  .dlc-kbd-help-close:hover { color: #eee; }
}
