/* ---------------------------------------------------------------------------
   orenbj.com — shared brand layer
   ---------------------------------------------------------------------------
   The single source of truth for the site's visual identity. Project pages keep
   their own interior design; this only supplies the chrome that makes them read
   as one site.

   Include on any page with one line, before </body>:

       <script src="/brand.js" defer></script>              document pages
       <script src="/brand.js" data-mode="app" defer></script>   full-viewport apps

   "app" mode shifts a fixed, full-bleed #map down by the bar height instead of
   padding the body, which does nothing for a fixed element.

   Re-add that line after replacing a page with a new build — it is the only
   branding hook, so there is nothing else to re-apply.
   --------------------------------------------------------------------------- */

:root {
  /* Identity — matches the home page and 404. */
  --ob-bg:        #030712;
  --ob-fg:        #f9fafb;
  --ob-muted:     #9ca3af;
  --ob-border:    #1f2937;
  --ob-orange:    #fb923c;
  --ob-purple:    #c084fc;
  --ob-blue:      #60a5fa;
  --ob-gradient:  linear-gradient(135deg, #fb923c 0%, #c084fc 50%, #60a5fa 100%);

  --ob-bar-h:     44px;
  --ob-font:      system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* --- tokens for project pages ------------------------------------------
     The bar above only needs the values already listed. These exist so a page
     rebuilt from its own source can adopt the site's look rather than
     approximate it: build against these names and it matches by construction.

     Metric Equinox is deliberately exempt — its own visual world is the point
     of the project, and the shared bar is enough to place it on this site.
     -------------------------------------------------------------------- */
  --ob-surface:      rgba(17, 24, 39, 0.65);   /* card / panel over --ob-bg   */
  --ob-surface-flat: #0c1220;                  /* same, composited & opaque   */
  --ob-radius:       16px;                     /* cards                       */
  --ob-radius-sm:    8px;                      /* controls                    */
  --ob-shadow:       0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --ob-shadow-hover: 0 12px 20px -3px rgba(0, 0, 0, 0.6);
  --ob-particle-alpha: 0.28;   /* opacity of the drifting background field */

  /* Every pair below clears WCAG AA on --ob-bg: fg 19.3:1, muted 7.9:1,
     and each accent above 7:1. Substituting other values forfeits that. */
}

.ob-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--ob-bar-h);
  z-index: 10000;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 clamp(0.75rem, 3vw, 1.25rem);

  /* Opaque rather than translucent: it sits over maps and light dashboards
     alike, and has to stay legible against both. */
  background: var(--ob-bg);
  border-bottom: 1px solid var(--ob-border);
  font-family: var(--ob-font);
  font-size: 0.875rem;
  line-height: 1;
  box-sizing: border-box;
}

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

.ob-bar a.ob-home,
.ob-bar a.ob-back {
  display: inline-flex !important;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none !important;
  color: var(--ob-fg) !important;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 0.4rem 0.5rem;
  margin: -0.4rem -0.5rem;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.ob-bar a.ob-home:hover,
.ob-bar a.ob-back:hover,
.ob-bar a:focus-visible { background: rgba(255, 255, 255, 0.06); }

.ob-bar a:focus-visible {
  outline: 2px solid var(--ob-purple);
  outline-offset: 1px;
}

.ob-bar .ob-mark { flex: none; display: block; }

.ob-bar .ob-name { color: inherit; }

.ob-bar a.ob-back {
  color: var(--ob-muted) !important;
  font-weight: 500;
}

.ob-bar a.ob-back:hover,
.ob-bar a.ob-back:focus-visible { color: var(--ob-purple) !important; }

/* Narrow screens: the wordmark alone carries the identity. */
@media (max-width: 420px) {
  .ob-bar .ob-name { display: none; }
  .ob-bar .ob-back { font-size: 0.82rem; }
}

@media (prefers-reduced-motion: reduce) {
  .ob-bar a { transition: none; }

  /* Safety net for branded pages whose own CSS predates the setting — the
     map bundles and dashboards this file cannot reach into. Collapses CSS
     transitions and animations rather than removing them, which keeps any
     code that waits on transitionend/animationend working. */
  html.ob-doc *,
  html.ob-app * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* The particle field sits behind everything and is decorative only. */
#obParticles {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* --- layout compensation ------------------------------------------------- */

/* Document pages: push the page's own content below the bar. */
html.ob-doc body { padding-top: var(--ob-bar-h); }

/* Full-viewport apps: the map is fixed, so padding the body does nothing.
   Shift the map itself instead. The bar may overlap the top of the map
   canvas — maps pan, so that costs nothing. */
html.ob-app body { padding-top: 0; }

html.ob-app #map,
html.ob-app .folium-map {
  top: var(--ob-bar-h) !important;
}

/* Leaflet's own top-left/top-right control stacks, which every folium map has. */
html.ob-app .leaflet-top { margin-top: var(--ob-bar-h); }

/* Anything else a page pins near the top is named by that page's own include,
   via data-offset — page-specific selectors do not belong in this file.
   Offsets are applied together so controls keep their spacing relative to
   each other. */
.ob-offset { margin-top: var(--ob-bar-h) !important; }

@media print {
  .ob-bar { display: none; }
  html.ob-doc body { padding-top: 0; }
}
