/* =========================================================
   Site navigation bar + breadcrumb
   ---------------------------------------------------------
   Injected at the top of every inner page by
   scripts/add-sitenav.py.

   Before this, 37 pages were dead ends: once a visitor landed
   on, say, a dynasty page, there was no link back anywhere.

   Everything here is namespaced `snav-` on purpose. The pages
   it is injected into use at least three unrelated stylesheets
   (page-header / page-hero / bare .container layouts), so this
   bar must not inherit from or collide with any of them.
   ========================================================= */

.snav {
  --snav-bg: rgba(10, 13, 18, 0.88);
  --snav-border: rgba(255, 255, 255, 0.10);
  --snav-text: #d8dee6;
  --snav-dim: #8b95a3;
  --snav-accent: #c5a15b;

  position: sticky;
  top: 0;
  z-index: 9000;

  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;

  margin: 0;
  padding: 0.55rem clamp(0.75rem, 3vw, 1.5rem);

  background: var(--snav-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--snav-border);

  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--snav-text);
  box-sizing: border-box;
}

.snav *,
.snav *::before,
.snav *::after { box-sizing: border-box; }

/* Home / brand */
.snav__home {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  /* 44px is the smallest reliable touch target; the bar is the main way out
     of every inner page, so its two controls have to clear it. */
  min-height: 44px;
  padding: 0.25rem 0.6rem 0.25rem 0.35rem;
  border-radius: 8px;
  color: var(--snav-text);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: background 0.2s ease, color 0.2s ease;
}

.snav__home:hover,
.snav__home:focus-visible {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.snav__logo {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  object-fit: cover;
  flex-shrink: 0;
}

/* Breadcrumb trail */
.snav__crumbs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
}

.snav__crumbs li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.snav__crumbs li::before {
  content: "›";
  color: var(--snav-dim);
  opacity: 0.7;
}

.snav__crumbs a {
  color: var(--snav-dim);
  text-decoration: none;
  padding: 0.6rem 0.35rem;
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 42vw;
}

.snav__crumbs a:hover,
.snav__crumbs a:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

/* The current page: shown, but not a link */
.snav__current {
  color: var(--snav-accent);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 48vw;
}

/* "Back to <parent>" — the single most useful control here, so it is
   pushed to the right edge where a thumb can reach it on a phone. */
.snav__back {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex-shrink: 0;
  min-height: 44px;
  padding: 0.3rem 0.9rem;
  border: 1px solid var(--snav-border);
  border-radius: 999px;
  color: var(--snav-text);
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.snav__back:hover,
.snav__back:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
}

.snav a:focus-visible {
  outline: 2px solid var(--snav-accent);
  outline-offset: 2px;
}

/* ---------- Phones ----------
   The trail is the first thing to go: on a 360px screen the back
   button and the home link are what people actually use. */
@media (max-width: 640px) {
  .snav {
    font-size: 0.8rem;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
  }

  .snav__crumbs li:not(:last-child) { display: none; }
  .snav__crumbs li::before { content: ""; }

  .snav__current { max-width: 38vw; }

  .snav__back span { display: none; }   /* arrow only */
  .snav__back::after { content: "Back"; }
}

/* Users who ask for less motion get no transitions */
@media (prefers-reduced-motion: reduce) {
  .snav *,
  .snav *::before { transition: none !important; }
}

/* Printing a page should not print the chrome */
@media print {
  .snav { display: none; }
}
