/* =========================================================================
   Shared top-nav header — REQ-272
   Self-contained: hard-coded v2.0 tokens so the header renders identically
   regardless of which page stylesheet is loaded. Previously lived inside
   dashboard.css; extracted so every non-home page can pull it.
   ========================================================================= */

.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(11, 10, 18, 0.72);
  border-bottom: 1px solid rgba(201, 168, 109, 0.18);
}
.nav-inner {
  max-width: 1240px; margin: 0 auto;
  padding: 16px 32px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px;
}

/* Minimal mode (auth pages): center the wordmark, hide the grid columns */
.nav--minimal .nav-inner {
  justify-content: center;
}

.logo {
  /* REQ-499: official SVG wordmark replaces the text wordmark.
     UX-audit X1: 44px hit-area floor preserved. */
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
}
.logo img {
  height: 22px;
  width: auto;
  display: block;
}

.nav-links {
  display: flex; gap: 24px;
}
.nav-links a {
  color: #b8ae99;
  text-decoration: none;
  position: relative;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  /* Audit P1-B: was 11px — below 12px label floor. */
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 6px 2px;
  border-bottom: 1px solid transparent;
  transition: color 180ms cubic-bezier(.2,.7,.2,1),
              border-color 180ms cubic-bezier(.2,.7,.2,1);
}
.nav-links a:hover { color: #c9a86d; border-bottom-color: rgba(201, 168, 109, 0.5); }
.nav-links a.active { color: #c9a86d; }
.nav-links a.active::after {
  content: ''; position: absolute; left: 50%; bottom: -6px;
  width: 4px; height: 4px; border-radius: 50%;
  background: #c9a86d; transform: translateX(-50%);
}

.avatar-btn {
  /* UX-audit X1 / auth_tarot F04: was 40×40 — bumped to 44 floor. */
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid #c9a86d;
  background: #161324;
  color: #c9a86d;
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
  font-size: 17px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: all 0.2s;
  text-decoration: none;
}
.avatar-btn:hover {
  background: #1c1930;
  box-shadow: 0 0 0 3px rgba(201, 168, 109, 0.18);
  border-color: #8a7649;
}

.nav-right {
  display: flex; align-items: center; gap: 14px;
}
.coin-chip {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 14px 7px 11px;
  border: 1px solid #c9a86d;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(201,168,109,0.09), rgba(201,168,109,0.03));
  color: #e4c98a;
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
  font-size: 16px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
}
.coin-chip:hover {
  background: rgba(201, 168, 109, 0.15);
  box-shadow: 0 0 0 3px rgba(201, 168, 109, 0.18);
  border-color: #8a7649;
}
.coin-chip .coin-glyph {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1px solid #c9a86d;
  display: grid; place-items: center;
  /* Audit P1-B: was 11px — bumped to 12px label floor. */
  font-size: 12px; line-height: 1;
  color: #c9a86d;
  background:
    radial-gradient(circle at 35% 30%, rgba(228, 201, 138, 0.35), transparent 70%),
    #0b0a12;
}
.coin-chip .coin-amount {
  font-weight: 500;
  font-feature-settings: 'tnum';
}
.coin-chip .coin-label {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  /* Audit P1-B: was 9.5px — below 12px label floor. */
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #908a7c;
}

.nav-logout {
  /* UX-audit X1 / auth_tarot F02: was 41×30 — destructive control needs the
     44 floor more than most. Visible label unchanged. */
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
  font-style: italic;
  font-size: 18px;
  color: #b8ae99;
  text-decoration: none;
  padding: 8px 10px;
  min-height: 44px;
  transition: color 0.2s;
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
}
.nav-logout:hover { color: #c9a86d; }
.nav-logout svg { width: 14px; height: 14px; }

/* Focus rings — accessibility */
.nav-links a:focus-visible,
.nav-logout:focus-visible,
.coin-chip:focus-visible,
.avatar-btn:focus-visible,
.nav-public-cta:focus-visible,
.nav-lang-switch a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(201, 168, 109, 0.55);
}

/* Public-nav (homepage, REQ-273) */
.nav-lang-switch {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  /* Audit P1-B: was 11px — bumped to 12px label floor. */
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #908a7c;
}
.nav-lang-switch a {
  color: #b8ae99;
  text-decoration: none;
  padding: 4px 2px;
  transition: color 180ms cubic-bezier(.2,.7,.2,1);
}
.nav-lang-switch a:hover { color: #c9a86d; }
.nav-lang-switch a.active { color: #c9a86d; }
.nav-lang-switch .sep { color: #4a4538; }

.nav-public-cta {
  display: inline-flex; align-items: center;
  padding: 12px 18px;
  min-height: var(--tap-min, 44px);
  border-radius: 2px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  /* Audit P1-B: was 10.5px — bumped to 12px label floor. */
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid #c9a86d;
  background: linear-gradient(180deg, #e4c98a 0%, #c9a86d 100%);
  color: #0b0a12;
  transition: filter 180ms cubic-bezier(.2,.7,.2,1),
              transform 180ms cubic-bezier(.2,.7,.2,1);
}
.nav-public-cta:hover { filter: brightness(1.15); transform: translateY(-1px); }

.nav-public-cta--ghost {
  background: transparent;
  color: #c9a86d;
  border-color: #8a7649;
}
.nav-public-cta--ghost:hover {
  filter: none;
  color: #e4c98a;
  border-color: #c9a86d;
}

/* Hamburger toggle — only visible on mobile (≤720px). */
.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(201, 168, 109, 0.32);
  border-radius: 4px;
  color: #c9a86d;
  cursor: pointer;
  align-items: center; justify-content: center;
  flex-direction: column;
  gap: 4px;
  transition: border-color 180ms cubic-bezier(.2,.7,.2,1),
              background-color 180ms cubic-bezier(.2,.7,.2,1);
}
.nav-toggle:hover { border-color: #c9a86d; background: rgba(201, 168, 109, 0.08); }
.nav-toggle:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(201, 168, 109, 0.55); }
.nav-toggle-bar {
  display: block;
  width: 18px; height: 1.5px;
  background: currentColor;
  border-radius: 2px;
}

/* Drawer container fills the viewport when open. */
.nav-drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0s linear 220ms;
  /* REQ-768 (b) — clip the panel parked at `translateX(100%)`. Without this it
     extends 320px past the right edge on EVERY page, and `body{overflow-x:hidden}`
     cannot hold it: on iOS Safari, with `html` at `overflow-x: visible`, the
     reader still pans to the overflow and finds the invisible drawer — reported
     as "swipe right and empty content appears". Clipped here, at the source,
     rather than by making `html` a scroll container, which is the usual remedy
     and breaks `position: sticky` beneath it. */
  overflow: hidden;
}
.nav-drawer.open {
  pointer-events: auto;
  visibility: visible;
  transition: visibility 0s linear 0s;
}
.nav-drawer-backdrop {
  position: absolute; inset: 0;
  background: rgba(11, 10, 18, 0.66);
  opacity: 0;
  transition: opacity 220ms cubic-bezier(.2,.7,.2,1);
  -webkit-tap-highlight-color: transparent;
}
.nav-drawer.open .nav-drawer-backdrop { opacity: 1; }
.nav-drawer-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(320px, 88vw);
  background: #0b0a12;
  border-left: 1px solid rgba(201, 168, 109, 0.22);
  display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top, 0px) + 18px)
          calc(env(safe-area-inset-right, 0px) + 22px)
          calc(env(safe-area-inset-bottom, 0px) + 18px)
          22px;
  transform: translateX(100%);
  transition: transform 220ms cubic-bezier(.2,.7,.2,1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.nav-drawer.open .nav-drawer-panel { transform: translateX(0); }
.nav-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px;
}
.nav-drawer-title {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #7a7466;
}
.nav-drawer-close {
  width: 44px; height: 44px;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(201, 168, 109, 0.22);
  border-radius: 4px;
  color: #c9a86d;
  cursor: pointer;
  display: grid; place-items: center;
  transition: border-color 180ms cubic-bezier(.2,.7,.2,1),
              background-color 180ms cubic-bezier(.2,.7,.2,1);
}
.nav-drawer-close:hover { border-color: #c9a86d; background: rgba(201, 168, 109, 0.08); }
.nav-drawer-close:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(201, 168, 109, 0.55); }
.nav-drawer-links {
  display: flex; flex-direction: column;
  gap: 2px;
  margin-bottom: 22px;
}
.nav-drawer-links a {
  display: flex; align-items: center;
  min-height: 48px;
  padding: 10px 6px;
  color: #e8e1d3;
  text-decoration: none;
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
  font-size: 19px;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(201, 168, 109, 0.08);
  transition: color 180ms cubic-bezier(.2,.7,.2,1);
}
.nav-drawer-links a:hover,
.nav-drawer-links a:focus-visible { color: #c9a86d; outline: none; }
.nav-drawer-links a.active { color: #c9a86d; }
.nav-drawer-divider {
  display: block;
  height: 1px;
  background: rgba(201, 168, 109, 0.18);
  margin: 14px 0 6px;
}
.nav-drawer-cta {
  color: #c9a86d !important;
  font-style: italic;
}
.nav-drawer-logout {
  display: flex; align-items: center;
  min-height: 48px;
  padding: 10px 6px;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(201, 168, 109, 0.08);
  cursor: pointer;
  color: #b8ae99;
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
  font-size: 19px;
  font-style: italic;
  letter-spacing: 0.04em;
  text-align: left;
  transition: color 180ms cubic-bezier(.2,.7,.2,1);
}
.nav-drawer-logout:hover,
.nav-drawer-logout:focus-visible { color: #c9a86d; outline: none; }
.nav-drawer-lang {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: auto;
  padding-top: 18px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.nav-drawer-lang a {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 10px;
  color: #b8ae99;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 4px;
  transition: color 180ms cubic-bezier(.2,.7,.2,1),
              border-color 180ms cubic-bezier(.2,.7,.2,1);
}
.nav-drawer-lang a:hover { color: #c9a86d; border-color: rgba(201, 168, 109, 0.32); }
.nav-drawer-lang a.active { color: #c9a86d; border-color: rgba(201, 168, 109, 0.45); }
.nav-drawer-lang .sep { color: #4a4538; }

/* Body scroll-lock while drawer is open. */
body.nav-drawer-locked { overflow: hidden; touch-action: none; }

@media (max-width: 820px) {
  .nav--public .nav-links { display: none; }
  /* Public-mode CTAs collapse into the drawer; keep them visible only ≥820px. */
  .nav--public .nav-lang-switch,
  .nav--public .nav-public-cta { display: none; }
  .nav--public .nav-toggle { display: inline-flex; }
}

@media (max-width: 720px) {
  .nav-inner { padding: 14px 20px; }
  .nav-links { display: none; }
  .coin-chip .coin-label { display: none; }
  .nav-right { gap: 10px; }
  .nav-logout { display: none; }
  .nav-toggle { display: inline-flex; }
}

/* Phone-class viewports — REQ-768 (d).
   A first pass (UX-audit dashboard F01) recorded the same defect, "header
   right cluster was overflowing the 390px viewport by ~22px (scrollWidth
   412)", and tightened padding, gap and coin-chip padding. Re-measured
   2026-08-30 on a signed-in dashboard: still 410. The tightening bought ~2px
   of the 22, because it never touched the element that consumes the width.

   `a.logo` is 231px — the wordmark at `height: 22px` — and it is a flex child
   with `min-width: auto`, which for a replaced element resolves to its
   intrinsic width, so it does not shrink no matter what the budget is. At
   390px the row has 362px of content box: 231 (logo) + 10 (gap) + 155
   (coin-chip + avatar + toggle) = 396. Signed OUT the right cluster is just
   the 44px toggle, which is why only authenticated pages overflowed — 25 of
   the 27 measured.

   So the wordmark is sized to the budget rather than the budget squeezed
   around the wordmark, and two rules make a recurrence structurally
   impossible instead of arithmetically lucky: the right cluster never shrinks
   (its targets are already at the 44px floor), and the logo may. If anything
   is ever added to the right, the wordmark clips — ugly, and never a page
   that pans. */
@media (max-width: 480px) {
  .nav-inner { padding: 12px 14px; gap: 10px; }
  .nav-right { gap: 6px; flex-shrink: 0; }
  .coin-chip { padding: 6px 10px 6px 8px; gap: 7px; }
  .logo { min-width: 0; overflow: hidden; }
  .logo img { height: 18px; }
}

/* Breadcrumbs — REQ-274. Sticky trail pinned below the top-nav. `.nav` sticks
   at top:0 with content-height ≈72px desktop / ≈68px mobile, so breadcrumbs
   sticks at top:72px (resp. 68px) and sits just below it. z-index 40 keeps it
   beneath the top-nav (z-index 50) but above page content.

   Horizontal padding lives on the inner <ol> so its content edge aligns
   exactly with `.nav-inner` (max-width:1240px, padding:16px 32px → 14px 20px
   on mobile). Putting padding on the outer .breadcrumbs band would push the
   first item 32px left of the TAROTSCOPE wordmark. */
.breadcrumbs {
  position: sticky;
  /* `--nav-height` is published by the inline header script (ResizeObserver
     on `header.nav`). Falls back to the historical 72px desktop / 68px
     mobile estimates if the script hasn't run yet (e.g. inside a noscript
     bootstrap), so first paint never overlaps the nav. */
  top: var(--nav-height, 72px);
  z-index: 40;
  background: rgba(11, 10, 18, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(201, 168, 109, 0.14);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.95rem;
  color: #b8ae99;
}
.breadcrumbs ol {
  max-width: 1240px;
  margin: 0 auto;
  list-style: none;
  padding: 0.75rem 32px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.breadcrumbs-link {
  /* UX-audit blog_post F03 / X1: was ~17px tall — 44px hit-area via padding. */
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 6px;
  margin: -10px -6px;
  color: #c9a86d;
  text-decoration: none;
  font-weight: 500;
  transition: color 180ms cubic-bezier(.2,.7,.2,1);
}
.breadcrumbs-link:hover,
.breadcrumbs-link:focus-visible {
  color: #e8e1d3;
}
.breadcrumbs-sep {
  color: #7a7466;
  font-size: 1.05rem;
  line-height: 1;
}
.breadcrumbs-current {
  color: #e8e1d3;
  font-weight: 500;
}
@media (max-width: 720px) {
  .breadcrumbs { font-size: 0.88rem; }
  .breadcrumbs ol { padding: 0.6rem 20px; }
}
