/* ──────────────────────────────────────────────────────────────
   Shared "Choose a tool" menu — loaded by every page.
   Markup + behaviour live in /tools-menu.js. Any element with
   [data-tools-menu] opens it. Uses only the --color-* tokens that
   every page already defines (with fallbacks), so it themes itself.
   ────────────────────────────────────────────────────────────── */

/* Button-style triggers are never underlined (the homepage's .btn-accent doesn't reset the default link underline) */
.nav-cta[data-tools-menu], .btn-accent[data-tools-menu] { text-decoration: none; }

/* Play triangle on text buttons that START a tool (replaces the → / ↗ glyphs: a tool is launched, not an external link) */
.btn-play { font-size: 1.15em; line-height: 1; margin-left: .35em; vertical-align: -.14em; }

/* Chevron on every trigger (CSS-only, so there is no layout shift on load) */
[data-tools-menu]::after {
  content: "";
  display: inline-block;
  flex: none;
  width: .42em; height: .42em;
  margin-left: .5em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-.14em) rotate(45deg);
  transition: transform .2s ease;
}
[data-tools-menu][aria-expanded="true"]::after {
  transform: translateY(.04em) rotate(225deg);
}
/* Narrow desktops / tablets: the tool pages carry up to 7 nav links and were already crowded around 1100px.
   Give back the width the two chevrons take (tighter gaps only; never nowrap, which turns wrapping into overflow). */
@media (max-width: 1240px) { nav .nav-center { gap: 20px; } }
@media (max-width: 1100px) { nav .nav-center { gap: 14px; } }
@media (max-width: 420px) {
  .nav-cta-free { display: none; }
}
/* On phones the top bar can't fit logo + theme switch + Sign in + CTA (the tool pages overflowed horizontally).
   The CTA is the only way to reach the tool menu there, so it wins the space — same rule the article pages already use.
   Scoped to bars that have a CTA, so signup.html keeps its Sign in link. */
@media (max-width: 480px) {
  nav:has(.nav-cta) .nav-signin { display: none; }
}

/* Panel */
.tm-panel {
  position: fixed; top: 0; left: 0; z-index: 300;
  width: min(660px, calc(100vw - 32px));
  max-height: calc(100dvh - 24px);
  overflow-y: auto; overscroll-behavior: contain;
  padding: 14px;
  background: var(--color-surface, #111115);
  border: 1px solid var(--color-border-strong, #2e2e38);
  border-radius: var(--r-lg, 14px);
  box-shadow: 0 28px 70px rgba(0, 0, 0, .5), 0 0 0 1px color-mix(in srgb, var(--color-primary, #7c6bf7) 10%, transparent);
  font-family: 'Inter', system-ui, sans-serif;
  text-align: left;
  opacity: 0; visibility: hidden;
  transform: translateY(-6px) scale(.985);
  transform-origin: 50% 0;
  transition: opacity .16s ease, transform .16s ease, visibility 0s linear .16s;
}
.tm-panel.is-open {
  opacity: 1; visibility: visible; transform: none;
  transition-delay: 0s;
}
html[data-theme='light'] .tm-panel {
  box-shadow: 0 24px 60px rgba(15, 26, 47, .18), 0 0 0 1px color-mix(in srgb, var(--color-primary, #2b63ff) 8%, transparent);
}

.tm-backdrop {
  position: fixed; inset: 0; z-index: 299;
  background: rgba(0, 0, 0, .5);
  opacity: 0; visibility: hidden;
  transition: opacity .16s ease, visibility 0s linear .16s;
}
.tm-backdrop.is-open { opacity: 1; visibility: visible; transition-delay: 0s; }
@media (min-width: 641px) { .tm-backdrop { display: none; } }

.tm-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 2px 6px 10px;
}
.tm-title {
  font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  color: var(--color-primary-text, var(--color-primary, #d79cff));
}
.tm-meta { font-size: 12px; color: var(--color-text-muted, #9098b2); }

.tm-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px;
}
.tm-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px;
  border: 1px solid transparent; border-radius: var(--r-md, 10px);
  color: var(--color-text, #f0f0f8); text-decoration: none;
  transition: background .15s ease, border-color .15s ease;
}
.tm-item:hover, .tm-item:focus-visible {
  background: color-mix(in srgb, var(--tc) 9%, var(--color-lift, #18181e));
  border-color: color-mix(in srgb, var(--tc) 45%, transparent);
  text-decoration: none;
}
.tm-item:focus-visible { outline: 2px solid var(--color-primary, #7c6bf7); outline-offset: 1px; }
.tm-ic {
  flex: none; width: 36px; height: 36px; border-radius: 9px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--tc) 16%, transparent);
  color: var(--tc);
}
.tm-ic i { font-size: 19px; line-height: 1; }
.tm-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.tm-name {
  font-size: 14px; font-weight: 700; line-height: 1.2; color: var(--color-text, #f0f0f8);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tm-tag {
  /* never truncated: the tag line is copy, and narrow widths wrap it instead */
  font-size: 12px; line-height: 1.3; color: var(--color-text-muted, #9098b2);
}
.tm-go {
  /* out of flow, so the play triangle never steals width from the label; centered on the row's horizontal midline */
  position: absolute; top: 50%; right: 12px;
  font-size: 15px; line-height: 1; color: var(--color-text-muted, #9098b2);
  opacity: 0; transform: translate(-4px, -50%);
  transition: opacity .15s ease, transform .15s ease, color .15s ease;
}
.tm-item:hover .tm-go, .tm-item:focus-visible .tm-go { opacity: 1; transform: translateY(-50%); color: var(--tc); }
@media (hover: none) { .tm-go { opacity: .55; transform: translateY(-50%); } }

/* Not-ready tools: same row in the same list, just quieter, with a "Soon" badge */
.tm-item--soon .tm-ic { filter: grayscale(.5); opacity: .8; }
.tm-item--soon .tm-name { color: var(--color-text-mid, #b3bbd4); }
.tm-badge {
  flex: none;
  font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px;
  color: var(--color-text-muted, #9098b2);
  border: 1px solid var(--color-border-strong, #2e2e38);
}

.tm-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 12px; padding: 12px 6px 2px;
  border-top: 1px solid var(--color-border, #222228);
  font-size: 12.5px; color: var(--color-text-muted, #9098b2);
}
.tm-all {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 700; color: var(--color-text-light, #d0d0e0); text-decoration: none;
  border-radius: 6px; padding: 2px 4px; margin: -2px -4px;
}
.tm-all:hover { color: var(--color-primary-text, var(--color-primary)); text-decoration: underline; text-underline-offset: 3px; }
.tm-all:focus-visible { outline: 2px solid var(--color-primary, #7c6bf7); outline-offset: 1px; }

.tm-sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Phones: full-width sheet, one column */
@media (max-width: 640px) {
  .tm-panel { width: auto; left: 8px !important; right: 8px; padding: 12px; }
  .tm-list { grid-template-columns: 1fr; }
  .tm-meta { display: none; }
  .tm-go { opacity: .55; transform: translateY(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .tm-panel, .tm-backdrop, [data-tools-menu]::after, .tm-item, .tm-go { transition: none; }
}
