/* Site navbar: the same bar on every page and inside every tool.
   Uses the shared design tokens (defined by site.css on site pages, and by each app on tool pages). */
:root { --site-nav-h: 52px; }

site-nav { display: block; height: var(--site-nav-h); flex: none; position: relative; z-index: 55; }

.sn {
  display: flex; align-items: center; gap: 2px;
  height: var(--site-nav-h);
  padding: 0 max(8px, calc((100vw - 1040px) / 2 - 6px));
  background: var(--color-surface, #161d2c);
  border-bottom: 1px solid var(--color-border, #36435d);
  color: var(--color-text, #e9eef8);
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: var(--text-base, 17px);
  line-height: 1.2;
}
site-nav[tool] .sn { padding: 0 8px; }

.sn a { color: inherit; text-decoration: none; }
.sn-brand {
  display: inline-flex; align-items: center; gap: 9px;
  height: 40px; padding: 0 8px; border-radius: 8px;
  font-weight: 650; letter-spacing: -0.01em; white-space: nowrap;
}
.sn-brand svg { width: 26px; height: 26px; flex: none; }
.sn-spacer { flex: 1; min-width: 4px; }

.sn-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 12px;
  border: 0; border-radius: 10px; background: transparent;
  color: var(--color-text, #e9eef8);
  font: inherit; font-weight: 600; white-space: nowrap; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 200ms cubic-bezier(0.2,0,0,1), color 200ms cubic-bezier(0.2,0,0,1);
}
.sn-btn svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.sn-btn[aria-expanded="true"] svg.sn-chev { transform: rotate(180deg); }
.sn-btn[aria-current="page"] { color: var(--color-accent-text, #7aa2ff); }
.sn-icon { width: 40px; padding: 0; justify-content: center; color: var(--color-text-muted, #a0abc1); }
@media (hover: hover) {
  .sn-btn:hover, .sn-brand:hover { background: var(--color-subtle, #202a3d); }
  .sn-icon:hover { color: var(--color-text, #e9eef8); }
}
.sn-btn:active { transform: scale(.96); }
.sn :focus-visible { outline: 2px solid var(--color-accent-text, #7aa2ff); outline-offset: 2px; }

.sn-short { display: none; }
@media (max-width: 480px) {
  .sn-long { display: none; }
  .sn-short { display: inline; }
  .sn-btn { padding: 0 10px; }
}
@media (max-width: 340px) { .sn-brand span { display: none; } }

/* Tools menu */
.sn-menu { position: relative; }
.sn-pop {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: min(360px, calc(100vw - 16px));
  max-height: min(70dvh, 520px); overflow: auto;
  padding: 6px;
  background: var(--color-surface, #161d2c);
  border: 1px solid var(--color-border, #36435d);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0,0,0,.35);
  opacity: 0; transform: translateY(-4px) scale(.98); transform-origin: top right;
  pointer-events: none;
  transition: opacity 160ms cubic-bezier(0.2,0,0,1), transform 160ms cubic-bezier(0.2,0,0,1);
}
.sn-pop.is-open { opacity: 1; transform: none; pointer-events: auto; }
@media (max-width: 480px) {
  .sn-menu { position: static; }
  .sn-pop { left: 8px; right: 8px; width: auto; top: calc(var(--site-nav-h) + 4px); transform-origin: top center; }
}
.sn-group { padding: 10px 10px 4px; font-size: var(--text-sm, 15px); font-weight: 650; color: var(--color-text-muted, #a0abc1); }
.sn-item { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: 10px; }
.sn-item strong { font-weight: 650; }
.sn-item span { font-size: var(--text-sm, 15px); color: var(--color-text-muted, #a0abc1); }
.sn-item[aria-current="page"] strong { color: var(--color-accent-text, #7aa2ff); }
@media (hover: hover) { .sn-item:hover { background: var(--color-subtle, #202a3d); } }
.sn-all { display: block; margin-top: 4px; padding: 12px 10px; border-top: 1px solid var(--color-border, #36435d); font-weight: 600; color: var(--color-accent-text, #7aa2ff) !important; border-radius: 0 0 10px 10px; }
@media (hover: hover) { .sn-all:hover { background: var(--color-subtle, #202a3d); } }

@media (prefers-reduced-motion: reduce) { .sn-pop, .sn-btn { transition: none; } }
