/* bionoia-overlay.css — Bionoia branding overrides on top of superstructure.css
 *
 * Drop in AFTER superstructure.css. Overrides only:
 *   - color palette (vellum + indigo + teal + copper, per BIONOIA.md §4)
 *   - body font (Inter)
 *   - heading font (Newsreader serif)
 *   - code/data font (JetBrains Mono)
 *
 * Does NOT touch superstructure.css itself — pure overlay so kit redeploys
 * leave it intact.
 *
 * Fonts: self-hosted woff2 (latin + latin-ext) in /web/fonts/.
 * No external CDN — matches BIONOIA.md §12 + GDPR-PRINCIPLES.md §4.
 */

@import url('fonts/fontface.css');

:root {
  /* === Background & surface — "vellum" cream feel === */
  --sst-bg:        #faf8f3;     /* warm cream, the vellum */
  --sst-bg2:       #f5f2ea;     /* subtle elevation */
  --sst-bg3:       #ffffff;     /* highest surface */
  --sst-card:      #ffffff;     /* card backgrounds */
  --sst-card2:     #f5f2ea;     /* alt card / nav */

  /* === Borders === */
  --sst-border:    rgba(28, 25, 23, 0.10);
  --sst-border2:   rgba(15, 118, 110, 0.30);

  /* === Brand colors — deep indigo (primary), teal-petrol (secondary), copper (accent) === */
  --sst-blue:      #1e1b4b;     /* deep indigo as primary action color */
  --sst-blue2:     #0f766e;     /* teal-petrol secondary */
  --sst-purple:    #1e1b4b;     /* purple maps to indigo */
  --sst-indigo:    #1e1b4b;     /* indigo direct */

  /* === Text === */
  --sst-body:      #1c1917;     /* warm near-black */
  --sst-muted:     #57534e;     /* warm gray for secondary text */
  --sst-faint:     #78716c;     /* captions, metadata */

  /* === Semantic colors === */
  --sst-green:     #166534;     /* established evidence */
  --sst-amber:     #b87333;     /* emerging — copper */
  --sst-red:       #991b1b;     /* contested */
  --sst-redbg:     rgba(153, 27, 27, 0.07);

  /* === Bionoia signature gradient — "Living Thread" === */
  --sst-grad:      linear-gradient(135deg, #0f766e 0%, #1e1b4b 100%);
  --sst-grads:     linear-gradient(135deg, rgba(15,118,110,0.10), rgba(30,27,75,0.06));

  /* === Review accent === */
  --sst-review-accent:    #b87333;       /* copper for review highlight */
  --sst-review-accent-bg: rgba(184, 115, 51, 0.08);

  /* === Typography overrides === */
  --sst-f:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --sst-f-serif:   'Newsreader', Georgia, 'Times New Roman', serif;
  --sst-f-mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --sst-r:         8px;
  --sst-r2:        12px;
}

/* === Headings use Newsreader serif === */
.sst-app h1, .sst-app h2, .sst-app h3, .sst-app h4 {
  font-family: var(--sst-f-serif);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--sst-body);
}

.sst-app h1 { font-weight: 600; }

/* === Code & data === */
.sst-app code, .sst-app pre, .sst-app kbd,
.sst-app [class*="mono"], .sst-app .sst-code {
  font-family: var(--sst-f-mono);
}

/* === Body line-height for long-form readability === */
.sst-app, .sst-app p, .sst-app li {
  line-height: 1.65;
}

/* === Bionoia wordmark style for header === */
.sst-app .sst-brand-title,
.sst-app [class*="brand"] [class*="title"],
#sst-standalone-btn {
  font-family: var(--sst-f-serif) !important;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* Hide kit's "Self-host" sub-label in the sidebar logo */
.sst-sb-logo sub {
  display: none !important;
}
/* Sidebar logo: show our SVG glyph beside the wordmark */
.sst-sb-logo {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}
.bio-sidebar-logo {
  height: 22px;
  width: auto;
  flex-shrink: 0;
}

/* === Evidence badges — bionoia-specific semantic addition === */
.bio-evidence {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--sst-f);
}
.bio-evidence.established  { background: rgba(22, 101, 52, 0.12);  color: #166534; }
.bio-evidence.emerging     { background: rgba(184, 115, 51, 0.14); color: #b87333; }
.bio-evidence.preliminary  { background: rgba(120, 113, 108, 0.12); color: #57534e; }
.bio-evidence.contested    { background: rgba(153, 27, 27, 0.10);   color: #991b1b; }

/* === Bionoia logo sizing in header === */
.sst-app .sst-brand-logo svg,
.sst-app [class*="brand"] svg {
  height: 28px;
  width: auto;
  vertical-align: middle;
}

/* === Hide kit's emoji nav-icons (CSS-level, more robust than JS-strip).
 * Labels alone read more professional for a research-site.
 * Reversible: remove this block to restore icons. === */
.sst-app .sst-navi-icon {
  display: none !important;
}
.sst-app .sst-navi {
  padding-left: 12px;
}

/* === Sidebar: clearer separation between section-headers (label only,
 * not clickable) and nav-items (clickable). Kit defaults make them too
 * similar in the bionoia palette. ===
 *
 * Section-headers: copper accent + uppercase + small top-rule.
 * Nav-items: darker body-text + subtle copper border on hover. */
.sst-app .sst-nav-sect {
  color: var(--sst-blue2) !important;     /* teal-petrol */
  font-size: 11px !important;
  letter-spacing: 0.16em !important;
  font-weight: 600 !important;
  padding: 0 12px !important;
  margin: 22px 0 6px !important;
  border-top: 1px solid var(--sst-border);
  padding-top: 14px !important;
  font-family: var(--sst-f) !important;    /* Inter, not serif */
}
.sst-app .sst-nav-sect:first-of-type {
  border-top: none;
  padding-top: 0 !important;
  margin-top: 8px !important;
}
.sst-app .sst-navi {
  color: var(--sst-body) !important;       /* darker, more "interactive" */
  font-size: 14px !important;
  font-weight: 400;
  border-left: 3px solid transparent !important;
  border-radius: 0 6px 6px 0 !important;
  padding-left: 12px !important;
  margin-left: 0;
  transition: all .12s ease;
}
.sst-app .sst-navi:hover {
  background: rgba(184, 115, 51, 0.08) !important;    /* copper tint */
  color: var(--sst-indigo) !important;
  border-left-color: var(--sst-amber) !important;     /* copper accent bar */
}
.sst-app .sst-navi.sst-active {
  background: rgba(15, 118, 110, 0.10) !important;    /* teal tint */
  color: var(--sst-blue) !important;
  border-left-color: var(--sst-blue) !important;       /* indigo accent */
  font-weight: 500;
}

/* === Bionoia background watermark — subtle "Living Thread" logo
 * placed bottom-right, low opacity, never interactive. Visible across
 * all admin SPA pages so the brand is always present without being loud.
 * Fixed positioning + pointer-events:none keeps it from interfering. === */
body::before {
  content: '';
  position: fixed;
  bottom: -80px;
  right: -100px;
  width: 600px;
  height: 720px;
  background-image: url('bionoia-logo.svg');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.07;
  pointer-events: none;
  z-index: 0;
}
/* CRITICAL: kit's .sst-app sets background:var(--sst-bg) which covers the
 * entire viewport and obscures body::before. Make it transparent — body's
 * bg-color (same value, set in index.html) shows through, and the
 * watermark is now visible. */
.sst-app {
  background: transparent !important;
}
/* Interactive content stays above the watermark */
.sst-app, #sst-root, .sst-sb, .sst-app-content,
.sst-modal, .sst-toast, .sst-standalone-ov {
  position: relative;
  z-index: 1;
}

/* === Bionoia notification dot — replaces kit's 🔔 bell with a calm
 * pulsing indicator. Copper accent matches Bionoia palette.
 * Idle: soft slow pulse. Unread (when kit reveals #sst-notif-badge):
 * solid + stronger color. === */
.bio-notif-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #b87333;
  box-shadow: 0 0 0 0 rgba(184, 115, 51, 0.5);
  animation: bioNotifPulse 2.4s ease-in-out infinite;
  vertical-align: middle;
  margin: 0 2px;
}
@keyframes bioNotifPulse {
  0%   { box-shadow: 0 0 0 0 rgba(184, 115, 51, 0.4); opacity: 0.7; }
  50%  { box-shadow: 0 0 0 6px rgba(184, 115, 51, 0);   opacity: 1; }
  100% { box-shadow: 0 0 0 0 rgba(184, 115, 51, 0);   opacity: 0.7; }
}
/* When unread badge is visible, dot turns indigo + faster pulse for attention */
#sst-notif-bell:has(#sst-notif-badge:not([style*="display:none"])) .bio-notif-dot {
  background: #1e1b4b;
  animation-duration: 1.4s;
}


/* Bell-container on its own line under user-info, INLINE EXPANDER
 * (no floating dropdown). Clicking expands the container itself
 * downward to reveal notifications inside the sidebar. */
.sst-sb-user {
  flex-wrap: wrap !important;
}
#sst-notif-bell {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 8px 12px !important;
  margin-top: 10px !important;
  flex-basis: 100% !important;
  width: 100% !important;
  border: 1px solid var(--sst-border) !important;
  border-radius: 6px !important;
  background: var(--sst-card) !important;
  transition: all .15s ease !important;
  position: relative !important;
}
#sst-notif-bell:hover {
  background: rgba(184, 115, 51, 0.08) !important;
  border-color: #b87333 !important;
}
#sst-notif-bell:has(#sst-notif-badge:not([style*="display:none"])) {
  border-color: #1e1b4b !important;
  background: rgba(30, 27, 75, 0.05) !important;
}
.bio-notif-label {
  font-size: 13px;
  color: var(--sst-body);
  font-family: var(--sst-f, Inter), sans-serif;
  font-weight: 500;
  letter-spacing: 0.01em;
}
#sst-notif-bell:has(#sst-notif-badge:not([style*="display:none"])) .bio-notif-label {
  color: #1e1b4b;
  font-weight: 600;
}
#sst-notif-badge {
  margin-left: auto !important;
  position: static !important;
  top: auto !important;
  right: auto !important;
}

/* HIDE kit's floating dropdown — we render our own inline expander */
#sst-notif-dropdown {
  display: none !important;
}

/* Bionoia inline expander */
.bio-notif-expander {
  display: block;
  flex-basis: 100%;
  width: 100%;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--sst-border);
}
.bio-notif-expander-empty {
  padding: 14px 4px;
  color: var(--sst-muted);
  font-size: 12px;
  text-align: center;
}
.bio-notif-item {
  padding: 10px;
  background: var(--sst-bg);
  border: 1px solid var(--sst-border);
  border-left: 3px solid var(--sst-border);
  border-radius: 4px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color .12s ease;
}
.bio-notif-item:hover { border-color: #b87333; }
.bio-notif-item.unread {
  border-left-color: #b87333;
  background: rgba(184, 115, 51, 0.04);
}
.bio-notif-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--sst-body);
  margin-bottom: 3px;
  line-height: 1.35;
}
.bio-notif-item.unread .bio-notif-title { color: #1e1b4b; }
.bio-notif-meta {
  font-size: 10px;
  color: var(--sst-faint);
}
.bio-notif-see-all {
  display: block;
  margin-top: 6px;
  padding: 8px 10px;
  text-align: center;
  color: var(--sst-blue);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background .12s ease;
}
.bio-notif-see-all:hover { background: rgba(184, 115, 51, 0.08); }

/* === Sidebar: always visible on desktop ===
 * Kit uses position:sticky which can fail on certain scroll paths
 * (esp. when an ancestor has overflow). Force a true fixed sidebar
 * on desktop and offset the main wrap to compensate. */
@media (min-width: 721px) {
  .sst-app-wrap {
    align-items: stretch !important;
  }
  .sst-sb {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    width: 246px !important;
    height: 100vh !important;
    max-height: 100vh !important;
    overflow-y: auto !important;
    z-index: 20 !important;
  }
  .sst-main-wrap {
    margin-left: 246px !important;
    min-height: 100vh !important;
  }
}

/* === Dark mode: keep the spirit but darker === */
:root[data-sst-theme="dark"] {
  --sst-bg:        #1a1814;
  --sst-bg2:       #221f1a;
  --sst-bg3:       #1a1814;
  --sst-card:      #2a2620;
  --sst-card2:     #322d26;

  --sst-border:    rgba(250, 248, 243, 0.10);
  --sst-border2:   rgba(15, 118, 110, 0.40);

  --sst-body:      #faf8f3;
  --sst-muted:     #d6d3c8;
  --sst-faint:     #a8a39a;

  --sst-blue:      #6366f1;
  --sst-blue2:     #14b8a6;
}
