/* ===========================================================================
   Site navigation. Loaded by layouts/partials/header.html, so every surface
   that includes the partial gets it, including the standalone documents.

   Every rule is scoped to .site-nav. The site used to style the bare `nav`
   element, which also caught the blog breadcrumb and the hub tabs.

   Tokens come from the page (blog.css, or the inline block in a standalone
   layout). This file declares none. See design-system.md, Token propagation.

   Design-system rules that bind here: no shadow (elevation is --edge), no hover
   lift, three radii only, weights 400/500/600, indigo is a fill and never text.
   =========================================================================== */

.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(6, 4, 14, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
}

.site-nav .sn-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.site-nav .sn-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
}

.site-nav .sn-wordmark {
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.02em;
  color: var(--light-text);
}

.site-nav .sn-wordmark .ai { color: var(--warm-rose); }

/* ----- link row ----- */

.site-nav .sn-links {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-left: auto;
}

.site-nav .sn-link,
.site-nav .sn-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--secondary-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  padding: 8px 0;
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 0.16s var(--ease);
}

.site-nav .sn-link:hover,
.site-nav .sn-trigger:hover,
.site-nav .sn-group.open > .sn-trigger,
.site-nav .sn-link.active,
.site-nav .sn-trigger.active { color: var(--light-text); }

.site-nav .sn-chevron { opacity: 0.7; }

.site-nav a:focus-visible,
.site-nav button:focus-visible {
  outline: 2px solid var(--lavender);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

/* ----- actions: GitHub, Sign up, menu button ----- */

.site-nav .sn-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

.site-nav .sn-github {
  display: inline-flex;
  align-items: center;
  color: var(--secondary-text);
  transition: color 0.16s var(--ease);
}
.site-nav .sn-github:hover { color: var(--light-text); }
.site-nav .sn-github svg { display: block; }

/* The nav CTA is defined in full here, not borrowed from the page's
   .btn-primary: the legal documents do not declare one. White on the indigo
   fill is 6.71:1, the one place indigo touches type. */
.site-nav .sn-cta {
  display: inline-block;
  background: var(--electric-indigo);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: background 0.16s var(--ease);
}
.site-nav .sn-cta:hover { background: var(--indigo-hover); }

.site-nav .sn-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--light-text);
  cursor: pointer;
  transition: border-color 0.16s var(--ease);
}
.site-nav .sn-menu-btn:hover { border-color: var(--border-hover); }
.site-nav .sn-menu-x { display: none; }
.site-nav.sheet-open .sn-menu-x { display: inline; }
.site-nav.sheet-open .sn-menu-bars { display: none; }

/* ----- panel ----- */

/* .site-nav is position: fixed with a backdrop-filter, which makes it the
   containing block for absolute AND fixed descendants. The panel and the mobile
   sheet are therefore placed from the bar, not from the viewport. */
.site-nav .sn-panel {
  position: absolute;
  top: 64px;
  left: 0;
  right: 0;
  padding: 8px 32px 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.16s var(--ease), visibility 0s linear 0.16s;
}

/* Hover bridge: covers the gap between the trigger and the card, so a pointer
   that moves down from the trigger does not leave the group on the way. */
.site-nav .sn-panel::before {
  content: "";
  position: absolute;
  top: -22px;
  left: 0;
  right: 0;
  height: 30px;
}

.site-nav .sn-group.open > .sn-panel,
html:not(.sn-js) .site-nav .sn-group:hover > .sn-panel,
html:not(.sn-js) .site-nav .sn-group:focus-within > .sn-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.16s var(--ease), visibility 0s;
}

.site-nav .sn-panel-card {
  position: relative;
  max-width: 1056px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 264px 1fr;
  background: var(--surface);
  border-radius: var(--r-md);
  box-shadow: var(--edge);
  overflow: hidden;
}

/* ----- feature column ----- */

.site-nav .sn-feature {
  display: flex;
  flex-direction: column;
  padding: 28px 24px 24px;
  background: rgba(109, 60, 200, 0.10);
  border-right: 1px solid var(--border);
}

.site-nav .sn-feature-label,
.site-nav .sn-col-label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lavender);
  margin: 0 0 18px;
}

.site-nav .sn-finding {
  background: var(--void);
  border-radius: var(--r-sm);
  box-shadow: var(--edge);
  padding: 14px;
}
.site-nav .sn-finding-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
/* High severity is the design system's semantic amber literal. */
.site-nav .sn-sev {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.09em;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  color: #E5A84B;
  border: 1px solid var(--border);
}
.site-nav .sn-finding-path,
.site-nav .sn-finding-cite {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--secondary-text);
  margin: 0;
}
.site-nav .sn-finding-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.012em;
  color: var(--light-text);
  margin: 0 0 10px;
}

.site-nav .sn-feature-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.site-nav .sn-feature-links a,
.site-nav .sn-all {
  font-size: 14px;
  color: var(--secondary-text);
  text-decoration: none;
  transition: color 0.16s var(--ease);
}
.site-nav .sn-feature-links a:hover,
.site-nav .sn-all:hover { color: var(--light-text); }

.site-nav .sn-all {
  margin-top: auto;
  padding-top: 24px;
  color: var(--lavender);
  font-weight: 500;
}

.site-nav .sn-quote {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.012em;
  color: var(--light-text);
  text-wrap: pretty;
}
.site-nav .sn-quote-by {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--secondary-text);
}

/* ----- item columns ----- */

.site-nav .sn-cols {
  display: grid;
  gap: 8px 24px;
  padding: 28px 24px 20px;
}
.site-nav .sn-cols-2 { grid-template-columns: repeat(2, 1fr); }
.site-nav .sn-cols-3 { grid-template-columns: repeat(3, 1fr); }

.site-nav .sn-col-label { padding-left: 10px; margin-bottom: 10px; }

.site-nav .sn-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav .sn-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px;
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: background 0.16s var(--ease);
}
.site-nav .sn-item:hover { background: rgba(109, 60, 200, 0.12); }

.site-nav .sn-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  color: var(--lavender);
  transition: border-color 0.16s var(--ease);
}
.site-nav .sn-item:hover .sn-icon { border-color: var(--border-hover); }

.site-nav .sn-item-text { display: block; min-width: 0; }
.site-nav .sn-item-title {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.3;
  color: var(--light-text);
}
.site-nav .sn-item-line {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--secondary-text);
}

/* ----- between the two breakpoints the link row gets tight ----- */
@media (max-width: 1000px) {
  .site-nav .sn-links { gap: 20px; }
  .site-nav .sn-inner { gap: 20px; }
  .site-nav .sn-panel-card { grid-template-columns: 1fr; }
  .site-nav .sn-feature { display: none; }
}

/* ----- mobile sheet ----- */
@media (max-width: 900px) {
  .site-nav .sn-menu-btn { display: inline-flex; }
  .site-nav .sn-actions { gap: 14px; margin-left: auto; }

  .site-nav .sn-links {
    display: none;
    position: absolute;
    top: 65px;
    left: 0;
    right: 0;
    height: calc(100vh - 65px);
    height: calc(100dvh - 65px);
    overflow-y: auto;
    overscroll-behavior: contain;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: 8px 24px 48px;
    background: var(--void);
  }
  .site-nav.sheet-open .sn-links { display: flex; }

  .site-nav .sn-link,
  .site-nav .sn-trigger {
    justify-content: space-between;
    width: 100%;
    padding: 18px 0;
    font-size: 17px;
    font-weight: 500;
    color: var(--light-text);
    border-bottom: 1px solid var(--border);
  }
  .site-nav .sn-chevron { width: 12px; height: 12px; transition: opacity 0.16s var(--ease); }
  .site-nav .sn-group.open .sn-chevron { opacity: 1; }

  /* The panel becomes an accordion body: in the flow, no card, no feature. */
  .site-nav .sn-panel,
  .site-nav .sn-group.open > .sn-panel,
  html:not(.sn-js) .site-nav .sn-group:hover > .sn-panel,
  html:not(.sn-js) .site-nav .sn-group:focus-within > .sn-panel {
    position: static;
    padding: 0;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: none;
  }
  .site-nav .sn-panel { display: none; }
  .site-nav .sn-group.open > .sn-panel,
  html:not(.sn-js) .site-nav .sn-panel { display: block; }
  .site-nav .sn-panel::before { display: none; }

  .site-nav .sn-panel-card {
    display: block;
    background: none;
    box-shadow: none;
    overflow: visible;
    border-bottom: 1px solid var(--border);
  }
  .site-nav .sn-cols,
  .site-nav .sn-cols-2,
  .site-nav .sn-cols-3 {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px 0 16px;
  }
  .site-nav .sn-col-label { padding-left: 0; }
  .site-nav .sn-item { padding: 10px 0; }
  .site-nav .sn-item:hover { background: none; }
}

@media (max-width: 420px) {
  .site-nav .sn-inner { padding: 0 20px; gap: 12px; }
  .site-nav .sn-github { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .site-nav *, .site-nav { transition-duration: 0.01ms !important; }
}

/* Set on <html> by nav.js while the sheet is open. */
html.sn-lock, html.sn-lock body { overflow: hidden; }

/* Without JavaScript the sheet cannot open, so the button would be dead. */
html:not(.sn-js) .site-nav .sn-menu-btn { display: none; }
