/* Bitstream Media branding overlay for Obico.
   Obico's colour-scheme.js writes --color-* as inline styles on <html>;
   !important here beats those. bsm.js sets data-bsm-theme from whichever
   scheme Obico picked, so the user's Light/Dark/System preference still works. */

/* ---- Dark (default) ---- */
html:root {
  --color-primary: #3b82f6 !important;
  --color-primary-hover: #60a5fa !important;
  --color-primary-muted: #1d4ed8 !important;
  --color-on-primary: #ffffff !important;
  --color-secondary: #e8ecf2 !important;
  --color-secondary-hover: #cdd5e0 !important;
  --color-on-secondary: #0d1117 !important;
  --color-background: #05080f !important;
  --color-surface-primary: #161b22 !important;
  --color-surface-secondary: #0d1117 !important;
  --color-overlay: #05080fcc !important;
  --color-hover: #ffffff0d !important;
  --color-hover-accent: #3b82f626 !important;
  --color-divider: #2a3546 !important;
  --color-divider-muted: #8ba1c41a !important;
  --color-text-primary: #e8ecf2 !important;
  --color-text-secondary: #8b97a8 !important;
  --color-text-help: #22d3ee !important;
  --color-input-background: #1e2535 !important;
  --color-input-placeholder: #cdd5e080 !important;
  --color-table-accent: #0f141c !important;
  --shadow-top-nav: 0 1px 0 rgba(139, 161, 196, 0.10), 0 8px 24px rgba(0, 0, 0, 0.35) !important;

  --bsm-grad: linear-gradient(115deg, #3b82f6 0%, #22d3ee 100%);
  --bsm-grad-text: linear-gradient(115deg, #e8ecf2 0%, #8fd8ff 45%, #5eead4 100%);
  --bsm-border: rgba(139, 161, 196, 0.10);
  --bsm-glow: 0 0 0 1px rgba(59, 130, 246, 0.15), 0 20px 60px rgba(0, 0, 0, 0.45);
  --bsm-eyebrow: #60a5fa;
}

/* ---- Light ---- */
html:root[data-bsm-theme="light"] {
  --color-primary: #2563eb !important;
  --color-primary-hover: #1d4ed8 !important;
  --color-primary-muted: #60a5fa !important;
  --color-on-primary: #ffffff !important;
  --color-secondary: #0f172a !important;
  --color-secondary-hover: #3f4a5a !important;
  --color-on-secondary: #f5f7fb !important;
  --color-background: #f5f7fb !important;
  --color-surface-primary: #ffffff !important;
  --color-surface-secondary: #eef2f8 !important;
  --color-overlay: #f5f7fbcc !important;
  --color-hover: #0f1e3c0d !important;
  --color-hover-accent: #2563eb1f !important;
  --color-divider: #cbd5e1 !important;
  --color-divider-muted: #0f1e3c1a !important;
  --color-text-primary: #0f172a !important;
  --color-text-secondary: #5b6877 !important;
  --color-text-help: #0891b2 !important;
  --color-input-background: #e2e8f1 !important;
  --color-input-placeholder: #3f4a5a80 !important;
  --color-table-accent: #eef2f8 !important;
  --shadow-top-nav: 0 1px 0 rgba(15, 30, 60, 0.08), 0 8px 24px rgba(15, 30, 60, 0.08) !important;

  --bsm-grad: linear-gradient(115deg, #2563eb 0%, #06b6d4 100%);
  --bsm-grad-text: linear-gradient(115deg, #0f172a 0%, #2563eb 45%, #0e7490 100%);
  --bsm-border: rgba(15, 30, 60, 0.10);
  --bsm-glow: 0 0 0 1px rgba(15, 30, 60, 0.05), 0 18px 50px rgba(15, 30, 60, 0.12);
  --bsm-eyebrow: #2563eb;
}

/* ---- Typography ---- */
html body,
html body .btn,
html body .form-control,
html body .navbar,
html body .card,
html body .modal,
html body .dropdown-menu,
html body .tooltip,
html body .popover,
.swal2-popup {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
}
html body h1, html body h2, html body h3, html body h4, html body h5 {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  letter-spacing: -0.02em;
}
html body code, html body pre, html body kbd, html body .text-monospace {
  font-family: 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;
}

/* ---- Logo (two lockups in one symbol; show the one for the surface) ----
   Ancestor selectors don't match inside a <use> clone, but custom properties
   inherit into it — so the theme switch goes through variables. */
html:root { --bsm-show-on-dark: inline; --bsm-show-on-light: none; }
html:root[data-bsm-theme="light"] { --bsm-show-on-dark: none; --bsm-show-on-light: inline; }
.bsm-logo-on-dark { display: var(--bsm-show-on-dark); }
.bsm-logo-on-light { display: var(--bsm-show-on-light); }

/* ---- Components ---- */
html body .card {
  border: 1px solid var(--bsm-border);
  border-radius: 10px;
  overflow: hidden;
}
html body .btn { border-radius: 6px; }
html body .btn-primary {
  background-image: var(--bsm-grad);
  border: 0;
}
html body .btn-primary:hover,
html body .btn-primary:focus { filter: brightness(1.08); }

/* ================= Share page ================= */
/* Hide Obico's own "sign up for Obico" pitch; bsm.js adds ours in its place. */
html.bsm-share .printer-card > div.p-3 { display: none !important; }

/* Upstream's .row sits outside a .container, so its negative margins overflow. */
html.bsm-share main .row.justify-content-center { margin-left: 0; margin-right: 0; }
/* Obico help/Discord links mean nothing to a share viewer. */
html.bsm-share nav li.nav-item:has(> a[href*="obico.io"]) { display: none; }

html.bsm-share .printer-card { padding-top: 1.5rem; padding-bottom: 3rem; }
html.bsm-share .printer-card > .card {
  box-shadow: var(--bsm-glow);
}
html.bsm-share .printer-card > .card > .card-header {
  font-weight: 700;
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--bsm-border);
}

.bsm-share-panel {
  margin-top: 1.5rem;
  padding: 2rem 1.5rem;
  text-align: center;
  background: var(--color-surface-secondary);
  border: 1px solid var(--bsm-border);
  border-radius: 16px;
  position: relative;
  overflow: hidden;
}
.bsm-share-panel::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--bsm-grad);
}
.bsm-share-panel .bsm-eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bsm-eyebrow);
  margin-bottom: 0.5rem;
}
.bsm-share-panel h2 {
  font-size: clamp(1.4rem, 3.5vw, 1.9rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text-primary);
  margin: 0 0 0.75rem;
}
.bsm-grad-text {
  background: var(--bsm-grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.bsm-share-panel p {
  color: var(--color-text-secondary);
  line-height: 1.7;
  max-width: 30rem;
  margin: 0 auto 1.5rem;
}
.bsm-share-panel .bsm-share-logo.bsm-logo-on-light { display: none; }
html[data-bsm-theme="light"] .bsm-share-panel .bsm-share-logo.bsm-logo-on-dark { display: none; }
html[data-bsm-theme="light"] .bsm-share-panel .bsm-share-logo.bsm-logo-on-light { display: block; }
.bsm-share-panel .bsm-share-logo {
  display: block;
  height: 56px;
  width: auto;
  margin: 0 auto 1.5rem;
}
.bsm-share-panel .bsm-share-cta {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: 6px;
  background: var(--bsm-grad);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transition: filter 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
.bsm-share-panel .bsm-share-cta:hover { filter: brightness(1.08); color: #fff; text-decoration: none; }
.bsm-share-panel .bsm-tagline {
  margin: 1.25rem auto 0;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--color-text-secondary);
  opacity: 0.8;
}

/* ---- Share page: no snapshot / stream ---- */
html.bsm-share img.stackedImage.bsm-broken { visibility: hidden; }
html.bsm-share .bsm-no-feed .streaming-info { display: none; }
.bsm-idle { display: none; }
html.bsm-share .bsm-no-feed .bsm-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  position: absolute;
  inset: 0;
  padding: 1.5rem 1.25rem;
  text-align: center;
  background: linear-gradient(to top, rgba(5, 8, 15, 0.92) 0%, rgba(5, 8, 15, 0.55) 40%, rgba(5, 8, 15, 0) 75%);
  pointer-events: none;
}
.bsm-idle-title {
  color: #e8ecf2;
  font-weight: 700;
  font-size: clamp(1.05rem, 2.6vw, 1.35rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.bsm-idle-sub {
  margin-top: 0.35rem;
  color: #cdd5e0;
  font-size: 0.9rem;
  line-height: 1.5;
}
