/* ════════════════════════════════════════════════════════════════════════
   shortcuts-page.css — Public ?route=shortcuts + admin ?route=help
   keyboard-shortcuts article.  Single source of truth for the shared
   `.shortcuts-*` vocabulary populated by assets/js/route-shortcuts.js
   from SHORTCUTS_MANIFEST.

   Two surfaces consume these rules:
     - #route-shortcuts > #shortcutsMount   (public page)
     - #help-keyboard   > #helpKeyboardMount (admin help inline)

   All tokens — every spacing/size/radius scales with --ui-scale +
   --ui-density per fretly-tokens.css doctrine.
   ════════════════════════════════════════════════════════════════════════ */

/* ── Route shell ─────────────────────────────────────────────────────── */
#route-shortcuts {
  padding: var(--space-3xl) var(--space-xl) var(--space-4xl);
}
#route-shortcuts .page-wrap {
  max-width: 62rem;             /* ~868 px reading width at scale 1 */
  margin: 0 auto;
}

/* ── Header — large title + subtitle, centered ───────────────────────── */
.shortcuts-page-header {
  margin: 0 0 var(--space-3xl);
  text-align: center;
}
.shortcuts-page-title {
  margin: 0 0 var(--space-sm);
  font-size: var(--font-3xl);
  font-weight: var(--weight-bold);
  color: var(--text);
  letter-spacing: -0.025em;
  line-height: var(--leading-tight, 1.2);
}
.shortcuts-page-sub {
  margin: 0;
  font-size: var(--font-lg);
  font-weight: var(--weight-normal);
  color: var(--text-2);
  line-height: var(--leading-snug, 1.4);
}

/* ── Mount — vertical stack of groups + ToC pill row at top ─────────── */
.shortcuts-page-mount,
.help-keyboard-mount {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

/* ── Table of contents ───────────────────────────────────────────────── */
.shortcuts-toc {
  margin: 0 0 var(--space-md);
  padding: 0;
  background: transparent;
  border: none;
}
.shortcuts-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: center;
}
.shortcuts-toc li {
  /* Override default UL ::marker / bullet behaviour on host pages
     (admin help and static-page both ship list rules that bullet
     every <li>).  Belt + braces: list-style + content reset. */
  list-style: none;
  margin: 0;
  padding: 0;
}
.shortcuts-toc li::before { content: none !important; }
.shortcuts-toc a {
  display: inline-block;
  padding: var(--space-xs) var(--space-md);
  font-size: var(--font-sm);
  font-weight: var(--weight-medium);
  color: var(--text-2);
  background: var(--surface-2, #f7f6f3);
  border: var(--border-w, 1px) solid var(--border);
  border-radius: var(--radius-full, 999px);
  text-decoration: none;
  line-height: 1;
  transition: background var(--t-fast, .15s),
              color      var(--t-fast, .15s),
              border-color var(--t-fast, .15s),
              transform  var(--t-fast, .15s);
}
.shortcuts-toc a:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}

/* ── Group cards — heading + context line + key/desc grid ───────────── */
.shortcuts-group {
  position: relative;
  background: var(--surface, #fff);
  border: var(--border-w, 1px) solid var(--border);
  border-radius: var(--radius-lg, 12px);
  padding: var(--space-xl) var(--space-2xl) var(--space-2xl);
  scroll-margin-top: var(--space-xl);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,0.03));
  transition: box-shadow var(--t-normal, .2s);
}
.shortcuts-group:hover {
  box-shadow: var(--shadow-md, 0 2px 8px rgba(0,0,0,0.05));
}
/* Accent left-edge on each card for visual rhythm. */
.shortcuts-group::before {
  content: '';
  position: absolute;
  left: 0;
  top: var(--space-lg);
  bottom: var(--space-lg);
  width: 0.2143rem;             /* ~3 px */
  background: var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  opacity: 0.7;
}

.shortcuts-group-title {
  margin: 0 0 var(--space-2xs);
  font-size: var(--font-xl);
  font-weight: var(--weight-semibold);
  color: var(--text);
  letter-spacing: -0.015em;
  line-height: var(--leading-tight, 1.25);
}
.shortcuts-group-context {
  margin: 0 0 var(--space-lg);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* ── Two-column grid: keys on left, descriptions on right ───────────── */
.shortcuts-list {
  display: grid;
  grid-template-columns: minmax(8rem, max-content) 1fr;
  column-gap: var(--space-2xl);
  row-gap: var(--space-md);
  margin: 0;
  padding: 0;
  align-items: center;
}
/* Horizontal rule between rows for scan-ability — using a
   pseudo-element on each DT so it spans both columns. */
.shortcuts-list > dt:not(:first-of-type),
.shortcuts-list > dd:not(:nth-of-type(1)) {
  border-top: var(--border-w, 1px) solid var(--border);
  padding-top: var(--space-md);
}
@media (max-width: 600px) {
  .shortcuts-list {
    grid-template-columns: 1fr;
    column-gap: 0;
    row-gap: var(--space-sm);
  }
  .shortcuts-list > dd:not(:nth-of-type(1)) {
    border-top: none;
    padding-top: 0;
  }
}

/* ── Keys row (DT) — chain of styled <kbd> chips ─────────────────────── */
.shortcuts-keys {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
  margin: 0;
  white-space: nowrap;
}

/* Individual key chip — pressed-button aesthetic. */
.shortcuts-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7143rem;          /* ~24 px */
  height: 1.7143rem;
  padding: 0 var(--space-xs);
  font-family: var(--font-mono, 'SF Mono', 'Consolas', monospace);
  font-size: var(--font-sm);
  font-weight: var(--weight-semibold);
  line-height: 1;
  color: var(--text);
  background: linear-gradient(180deg,
              var(--surface, #fff) 0%,
              var(--surface-2, #f7f6f3) 100%);
  border: var(--border-w, 1px) solid var(--border);
  border-bottom-width: var(--border-w-thick, 2px);
  border-radius: var(--radius-sm, 4px);
  box-shadow:
    var(--shadow-sm, 0 1px 0 rgba(0,0,0,0.04)),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
/* Word-length keys (e.g. "Click on title") still need to read as keys
   but the chip should reflow rather than clip — wider, slightly
   smaller type, no min-width. */
.shortcuts-key:where([class]) {
  /* No-op: keeps specificity stable for theme overrides. */
}

/* `/` separator when an item lists alternative keys
   (e.g. `←` / `→`). */
.shortcuts-key-sep {
  color: var(--text-3);
  font-size: var(--font-sm);
  font-weight: var(--weight-medium);
  margin: 0 var(--space-2xs);
  user-select: none;
}

/* ── Description (DD) ────────────────────────────────────────────────── */
.shortcuts-desc {
  margin: 0;
  padding: 0;
  font-size: var(--font-base);
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal, 1.55);
  color: var(--text-2);
}
.shortcuts-only {
  display: inline-block;
  margin-left: var(--space-xs);
  padding: 0.0714rem var(--space-xs);     /* ~1 px y-pad */
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: rgba(232, 135, 74, 0.12);
  border-radius: var(--radius-sm, 3px);
  vertical-align: middle;
  line-height: 1.4;
}

/* ── Footer note ─────────────────────────────────────────────────────── */
.shortcuts-page-foot {
  margin-top: var(--space-3xl);
  padding-top: var(--space-xl);
  border-top: var(--border-w, 1px) solid var(--border);
  text-align: center;
  font-size: var(--font-sm);
  color: var(--text-3);
  line-height: var(--leading-normal, 1.55);
}
.shortcuts-page-foot kbd {
  display: inline-block;
  min-width: 1.2857rem;
  padding: 0 var(--space-xs);
  font-family: var(--font-mono, 'SF Mono', 'Consolas', monospace);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
  background: var(--surface-2);
  border: var(--border-w, 1px) solid var(--border);
  border-bottom-width: var(--border-w-thick, 2px);
  border-radius: var(--radius-sm, 3px);
  vertical-align: 1px;
}

/* ── Admin help embed — strip the route-scoped chrome so the article
   reads as a natural section under the help shell ───────────────────── */
.help-content .help-keyboard-mount .shortcuts-group {
  /* Inside the admin help article the surrounding chrome already
     provides a card frame.  Reduce visual nesting by softening the
     inner cards a notch. */
  box-shadow: none;
  background: var(--surface-2, #faf9f6);
}
.help-content .help-keyboard-mount .shortcuts-toc {
  margin-top: var(--space-sm);
}
