/* Site nav — one stylesheet for every static marketing page.
 *
 * Everything is scoped under .dsd-nav so it never collides with the per-page
 * .nav rules those pages already carry inline. The markup is stamped INTO each
 * page by scripts/seo/stamp-nav.mjs rather than injected at runtime: nav links
 * are internal links, and this site's whole problem is pages Google has never
 * crawled — JS-injected links would be exactly the wrong trade.
 *
 * .dsd-drawer is display:contents on desktop, so the menu and the auth pair lay
 * out as if they were direct flex children of the nav; on mobile it becomes the
 * single collapsing panel that holds both. One wrapper, no duplicated markup.
 */

.dsd-nav {
  position: sticky; top: 0; z-index: 200;
  display: flex; align-items: center; gap: 16px;
  height: 60px; padding: 0 24px;
  background: rgba(232, 230, 225, .92);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule, rgba(21,24,28,.14));
  font-family: var(--sans, 'Inter', system-ui, sans-serif);
}
.dsd-nav .dsd-drawer { display: contents; }

/* ---- brand ---- */
.dsd-nav .dsd-brand { display: flex; align-items: center; gap: 9px; text-decoration: none; flex: 0 0 auto; }
.dsd-nav .dsd-brand svg { display: block; width: 27px; height: 27px; }
.dsd-nav .dsd-brand span {
  font-family: var(--mono, 'JetBrains Mono', Menlo, monospace);
  font-size: 12.5px; letter-spacing: .9px; text-transform: uppercase;
  color: var(--ink, #15181c);
}

/* ---- centred menu ---- */
.dsd-nav .dsd-menu {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px;
}
.dsd-nav .dsd-item { position: relative; }
.dsd-nav .dsd-trigger {
  appearance: none; -webkit-appearance: none; border: 0; background: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px; border-radius: 3px;
  font-family: var(--mono, 'JetBrains Mono', Menlo, monospace);
  font-size: 11px; letter-spacing: .7px; text-transform: uppercase;
  color: var(--ink-soft, rgba(21,24,28,.7));
  transition: color .12s, background .12s;
}
.dsd-nav .dsd-trigger::after {
  content: ""; width: 5px; height: 5px; margin-top: -3px;
  border-right: 1.4px solid currentColor; border-bottom: 1.4px solid currentColor;
  transform: rotate(45deg); opacity: .5; transition: transform .16s, opacity .12s;
}
.dsd-nav .dsd-item:hover .dsd-trigger,
.dsd-nav .dsd-item:focus-within .dsd-trigger,
.dsd-nav .dsd-item.open .dsd-trigger { color: var(--ink, #15181c); background: rgba(21,24,28,.05); }
.dsd-nav .dsd-item:hover .dsd-trigger::after,
.dsd-nav .dsd-item:focus-within .dsd-trigger::after,
.dsd-nav .dsd-item.open .dsd-trigger::after { transform: rotate(225deg) translate(-2px,-2px); opacity: .9; }

/* ---- panel ---- */
.dsd-nav .dsd-panel {
  position: absolute; top: calc(100% + 9px); left: 50%;
  transform: translateX(-50%) translateY(-4px);
  min-width: 252px; padding: 8px;
  background: var(--surface, #f2f0ea);
  border: 1px solid var(--rule-strong, rgba(21,24,28,.3));
  box-shadow: 0 14px 34px -14px rgba(21,24,28,.35);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .14s ease, transform .14s ease, visibility .14s;
}
/* hover bridge — crossing the gap from trigger to panel must not close it */
.dsd-nav .dsd-panel::before { content: ""; position: absolute; left: 0; right: 0; top: -11px; height: 11px; }
.dsd-nav .dsd-item:hover .dsd-panel,
.dsd-nav .dsd-item:focus-within .dsd-panel,
.dsd-nav .dsd-item.open .dsd-panel {
  opacity: 1; visibility: visible; pointer-events: auto; transform: translateX(-50%) translateY(0);
}
.dsd-nav .dsd-panel a {
  display: block; padding: 8px 11px; border-radius: 3px;
  font-size: 14px; line-height: 1.35; color: var(--ink, #15181c); text-decoration: none;
  transition: background .1s;
}
.dsd-nav .dsd-panel a:hover { background: var(--paper, #e8e6e1); }
.dsd-nav .dsd-panel a small {
  display: block; font-size: 11.5px; color: var(--ink-mute, rgba(21,24,28,.45)); margin-top: 1px;
}
.dsd-nav .dsd-panel hr { border: 0; border-top: 1px solid var(--rule, rgba(21,24,28,.14)); margin: 7px 4px; }
/* a long menu (Product) reads as a wall at one column — split it in two */
.dsd-nav .dsd-panel.wide { min-width: 496px; columns: 2; column-gap: 4px; }
.dsd-nav .dsd-panel.wide a, .dsd-nav .dsd-panel.wide hr { break-inside: avoid; }

/* ---- auth ---- */
.dsd-nav .dsd-auth { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.dsd-nav .dsd-auth a {
  font-family: var(--mono, 'JetBrains Mono', Menlo, monospace);
  font-size: 11px; letter-spacing: .7px; text-transform: uppercase; text-decoration: none;
  padding: 9px 15px; border: 1px solid transparent; white-space: nowrap;
}
.dsd-nav .dsd-login { color: var(--ink-soft, rgba(21,24,28,.7)); }
.dsd-nav .dsd-login:hover { color: var(--ink, #15181c); background: rgba(21,24,28,.05); }
.dsd-nav .dsd-signup {
  background: var(--ink, #15181c); color: var(--paper, #e8e6e1);
  border-color: var(--ink, #15181c); font-weight: 600;
}
.dsd-nav .dsd-signup:hover { background: #2a3038; }

/* ---- burger ---- */
.dsd-nav .dsd-burger {
  display: none; appearance: none; -webkit-appearance: none;
  border: 1px solid var(--rule-strong, rgba(21,24,28,.3)); background: none; cursor: pointer;
  width: 40px; height: 34px; margin-left: auto; padding: 0;
  align-items: center; justify-content: center; flex-direction: column; gap: 4px;
}
.dsd-nav .dsd-burger i { display: block; width: 16px; height: 1.4px; background: var(--ink, #15181c); }

/* ---- mobile ---- */
@media (max-width: 900px) {
  .dsd-nav { padding: 0 18px; }
  .dsd-nav .dsd-burger { display: flex; }
  .dsd-nav .dsd-drawer {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch;
    padding: 8px 14px 16px;
    background: var(--paper, #e8e6e1);
    border-bottom: 1px solid var(--rule-strong, rgba(21,24,28,.3));
    box-shadow: 0 16px 30px -18px rgba(21,24,28,.4);
    max-height: calc(100vh - 60px); overflow-y: auto;
  }
  .dsd-nav.open .dsd-drawer { display: flex; }
  .dsd-nav .dsd-menu { position: static; transform: none; flex-direction: column; align-items: stretch; gap: 0; }
  .dsd-nav .dsd-trigger { width: 100%; justify-content: space-between; padding: 13px 6px; font-size: 12px; }
  .dsd-nav .dsd-panel {
    position: static; transform: none; min-width: 0;
    opacity: 1; visibility: visible; pointer-events: auto;
    display: none; border: 0; box-shadow: none; background: none;
    padding: 0 0 8px 10px; transition: none;
  }
  .dsd-nav .dsd-panel::before { display: none; }
  /* touch has no hover: only an explicitly opened item expands. These need the
   * same specificity as their desktop counterparts (.dsd-nav .dsd-item.open
   * .dsd-panel) or the desktop transform:translateX(-50%) still wins and drags
   * the now-static panel half its own width off the left edge. */
  .dsd-nav .dsd-item:hover .dsd-panel,
  .dsd-nav .dsd-item:focus-within .dsd-panel { display: none; transform: none; }
  .dsd-nav .dsd-item.open .dsd-panel { display: block; transform: none; }
  .dsd-nav .dsd-panel.wide { columns: 1; min-width: 0; }
  .dsd-nav .dsd-auth {
    margin: 12px 0 0; padding-top: 14px;
    border-top: 1px solid var(--rule, rgba(21,24,28,.14));
  }
  .dsd-nav .dsd-auth a { flex: 1; text-align: center; justify-content: center; }
}
