/*
 * OpenBase 专用样式（集中归档）
 * 存在原因：Bootstrap 组件与 CSS variables 无法直接表达的少量布局——
 * 登录页深色双栏、工作台上下文条与抽屉层级。颜色一律从 Bootstrap 变量派生，
 * 不在页面散写。修改须同步更新 web/assets/README.md 的说明。
 */

/* ---------- 登录页：深色双栏 ---------- */
.ob-login-body { background: var(--bs-body-bg); }

.ob-login-split {
  display: grid;
  grid-template-columns: 58% 42%;
  min-height: 100vh;
}

.ob-login-visual {
  position: relative;
  background: linear-gradient(160deg, #0b1524 0%, #0f2233 55%, #12303c 100%);
  overflow: hidden;
}

.ob-login-visual-fallback {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 45% at 30% 35%, rgba(15, 94, 110, .35), transparent 70%),
    radial-gradient(ellipse 45% 40% at 75% 65%, rgba(25, 135, 84, .18), transparent 70%);
}

.ob-login-chart { position: absolute; inset: 0; }

.ob-login-caption {
  position: absolute; left: 2.5rem; bottom: 2.5rem; right: 2.5rem;
  color: rgba(233, 240, 248, .92);
}
.ob-login-slogan { font-size: 1.6rem; font-weight: 600; margin-bottom: .25rem; }
.ob-login-sub { font-size: .85rem; color: rgba(233, 240, 248, .6); margin: 0; }

.ob-login-pause {
  position: absolute; top: 1rem; right: 1rem; z-index: 3;
  border-color: rgba(233, 240, 248, .4); color: rgba(233, 240, 248, .85);
}

.ob-login-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 2rem clamp(1.5rem, 4vw, 4rem);
  background: var(--bs-body-bg);
}
.ob-login-form-wrap { width: 100%; max-width: 26rem; }
.ob-brand { font-weight: 700; letter-spacing: .02em; margin-bottom: 0; }
.ob-tagline { color: var(--bs-secondary-color); margin-bottom: 0; }

/* 窄屏：表单优先，动效降为低占比顶部背景 */
@media (max-width: 767.98px) {
  .ob-login-split { grid-template-columns: 1fr; grid-template-rows: 34vh 1fr; }
  .ob-login-caption { left: 1rem; right: 1rem; bottom: 1rem; }
  .ob-login-slogan { font-size: 1.1rem; }
  .ob-login-panel { min-height: 66vh; }
}

/* 减少动态效果：静态结构图（由 JS 检测并停止动画循环） */
@media (prefers-reduced-motion: reduce) {
  .ob-login-chart { opacity: .55; }
}

/* ---------- 工作台外壳 ---------- */
.ob-topbar { position: sticky; top: 0; z-index: 1030; }
.ob-navbar { box-shadow: 0 1px 0 var(--bs-border-color-translucent); }

.ob-contextbar {
  position: sticky; top: 56px; z-index: 1020;
  background: color-mix(in srgb, var(--bs-primary) 6%, var(--bs-body-bg));
  border-bottom: 1px solid var(--bs-border-color-translucent);
  font-size: .82rem;
}
.ob-ctx-label { font-weight: 600; color: var(--bs-emphasis-color); }

.ob-main-canvas {
  min-height: calc(100vh - 140px);
  padding-top: 1.25rem;
  padding-bottom: 2rem;
  outline: none;
}

.ob-statusbar {
  border-top: 1px solid var(--bs-border-color-translucent);
  background: var(--bs-tertiary-bg);
}

/* 主画布始终是最强对比层；抽屉使用较弱背景层级 */
.ob-drawer { width: min(480px, 100vw); background: var(--bs-tertiary-bg); }
.ob-drawer-header { border-bottom: 1px solid var(--bs-border-color-translucent); }

@media (max-width: 767.98px) {
  .ob-drawer { width: 100vw; }
  .ob-contextbar { top: 0; } /* 窄屏导航折叠后上下文条贴顶 */
}

/* ---------- 阅读与内容 ---------- */
.ob-reading { max-width: 60vw; }
.ob-wiki-body { font-size: 1rem; line-height: 1.8; }
.ob-wiki-body h1, .ob-wiki-body h2, .ob-wiki-body h3 { scroll-margin-top: 130px; }
.ob-wiki-body table { width: auto; max-width: 100%; font-size: .88rem; }

.ob-toc .nav-link { color: var(--bs-secondary-color); }
.ob-toc .nav-link:hover { color: var(--bs-body-color); }

/* 对象链接：可下钻的稳定 ID 入口（文字+下划线+颜色三重表达） */
a.ob-object-link, button.ob-object-link {
  color: var(--bs-primary-text-emphasis);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
}
a.ob-object-link:hover, button.ob-object-link:hover { text-decoration: underline solid; }

/* ---------- 搜索命令面板 ---------- */
.ob-search-form { position: relative; min-width: 220px; }
.ob-palette {
  position: absolute; top: 100%; right: 0; left: 0; margin-top: .35rem;
  max-height: 60vh; overflow-y: auto; z-index: 1050; min-width: 280px;
}
.ob-palette .dropdown-item.active, .ob-palette .dropdown-item:active {
  background: var(--bs-primary-bg-subtle); color: var(--bs-body-color);
}

/* ---------- 登出后清屏 ---------- */
body.ob-logged-out #ob-workbench { display: none; }
