/* Orbita shell: boot, login, home screen, app stage, switcher. Uses the tokens from ui.css. */

html, body {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  overflow: hidden;
}

#ob-root {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  overflow: hidden;
  background: var(--ob-bg);
  /* static background, painted once */
  background-image: radial-gradient(ellipse at 18% -10%, #18283a 0%, rgba(11, 14, 20, 0) 58%),
    radial-gradient(ellipse at 105% 110%, #1d1a2c 0%, rgba(11, 14, 20, 0) 55%);
}

.ob-screen {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  display: none;
}
.ob-screen.is-on {
  display: block;
  -webkit-animation: ob-screen-in .18s ease-out; animation: ob-screen-in .18s ease-out;
}
@-webkit-keyframes ob-screen-in { from { opacity: 0; -webkit-transform: scale(.985); } to { opacity: 1; -webkit-transform: scale(1); } }
@keyframes ob-screen-in { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: scale(1); } }

/* ---------- boot ---------- */

#ob-boot { text-align: center; padding-top: 30vh; z-index: 5; }
#ob-boot img { width: 84px; height: 84px; border-radius: 42px; display: block; margin: 0 auto 22px; }
#ob-boot p { color: var(--ob-muted); margin: 14px 20px; }

/* ---------- login ---------- */

#ob-login { z-index: 80; background: var(--ob-bg); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.ob-login-box { width: 100%; max-width: 400px; margin: 0 auto; padding: 11vh 20px 40px; text-align: center; }
.ob-login-logo { width: 88px; height: 88px; border-radius: 44px; display: block; margin: 0 auto 18px; }
.ob-login-name { font-size: 34px; font-weight: 200; letter-spacing: 6px; margin: 0 0 4px; text-transform: uppercase; }
.ob-login-sub { color: var(--ob-muted); margin: 0 0 28px; }
.ob-login-key {
  text-align: center; font-family: var(--ob-mono); font-size: 20px; letter-spacing: 2px;
  min-height: 54px; text-transform: uppercase;
}
.ob-login-err { min-height: 22px; margin: 12px 0; color: var(--ob-danger); font-size: 14px; }
.ob-login-help { margin-top: 26px; font-size: 13px; color: var(--ob-muted); line-height: 1.5; }
.ob-login-toggle { margin-top: 8px; }

/* ---------- home ---------- */

#ob-home { z-index: 10; }
.ob-home-head {
  position: absolute; top: 0; left: 0; right: 0; height: 150px;
  padding: 30px 40px 0;
  display: -webkit-flex; display: flex;
  -webkit-justify-content: space-between; justify-content: space-between;
  -webkit-align-items: flex-start; align-items: flex-start;
}
.ob-clock { font-size: 68px; font-weight: 200; line-height: 1; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.ob-date { margin-top: 8px; font-size: 17px; color: var(--ob-text-2); }
.ob-date::first-letter { text-transform: uppercase; }
.ob-home-status { text-align: right; padding-top: 6px; }
.ob-brand { font-size: 13px; font-weight: 600; letter-spacing: 4px; text-transform: uppercase; color: var(--ob-muted); }

.ob-conn { display: -webkit-inline-flex; display: inline-flex; -webkit-align-items: center; align-items: center; margin-top: 10px; font-size: 13px; color: var(--ob-muted); }
.ob-conn i { display: block; width: 9px; height: 9px; border-radius: 5px; margin-right: 7px; background: var(--ob-danger); }
.ob-conn.is-on i { background: var(--ob-ok); }
.ob-conn.is-on { color: var(--ob-text-2); }

.ob-home-scroll { position: absolute; top: 150px; right: 0; bottom: 0; left: 0; padding: 10px 30px 40px; }
.ob-home-grid {
  display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; /* fallback */
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  grid-gap: 18px 6px;
}
.ob-app {
  position: relative; width: 136px; /* fallback width for the flex layout */
  padding: 12px 6px 8px; text-align: center; border-radius: var(--ob-radius);
  -webkit-transition: opacity .12s, -webkit-transform .12s; transition: opacity .12s, transform .12s;
}
@supports (display: grid) { .ob-app { width: auto; } }
.ob-app.is-pressed { opacity: .7; -webkit-transform: scale(.93); transform: scale(.93); }
.ob-app-glyph {
  position: relative; width: 84px; height: 84px; margin: 0 auto; border-radius: 42px;
  display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  color: #fff; background: var(--ob-surface-3);
  box-shadow: 0 0 0 5px rgba(255, 255, 255, .045);
}
.ob-app-glyph svg { width: 42px; height: 42px; display: block; }
.ob-app-name { margin-top: 12px; font-size: 14px; font-weight: 500; color: var(--ob-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ob-app-run { display: block; width: 6px; height: 6px; border-radius: 3px; margin: 6px auto 0; background: transparent; }
.ob-app.is-running .ob-app-run { background: var(--ob-accent); }
.ob-app .ob-badge { position: absolute; top: 6px; left: 50%; margin-left: 20px; }
.ob-home-empty { padding: 60px 20px; text-align: center; color: var(--ob-muted); }

/* ---------- stage (running apps) ---------- */

#ob-stage { z-index: 20; background: var(--ob-bg); }
#ob-bar {
  position: absolute; top: 0; left: 0; right: 0; height: var(--ob-bar-h); z-index: 2;
  display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center;
  padding: 0 6px;
  background: var(--ob-bg-2); border-bottom: 1px solid var(--ob-line-soft);
}
.ob-bar-btn {
  -webkit-flex: none; flex: none; width: 46px; height: 44px; padding: 0; border: 0; border-radius: 10px;
  background: transparent; color: var(--ob-text-2);
  display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  -webkit-appearance: none; appearance: none;
}
.ob-bar-btn svg { width: 24px; height: 24px; display: block; }
.ob-bar-btn.is-pressed { background: var(--ob-surface-2); color: var(--ob-text); }
.ob-bar-app { display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; margin-left: 6px; min-width: 0; -webkit-flex: 0 1 auto; flex: 0 1 auto; }
.ob-bar-icon {
  -webkit-flex: none; flex: none; width: 28px; height: 28px; border-radius: 14px; margin-right: 10px; color: #fff;
  display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
}
.ob-bar-icon svg { width: 16px; height: 16px; display: block; }
.ob-bar-title { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Per-app slot: apps put their own buttons here through api.bar */
.ob-bar-slot {
  -webkit-flex: 1 1 0%; flex: 1 1 0%; min-width: 0; height: 100%;
  display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center;
  -webkit-justify-content: flex-end; justify-content: flex-end;
  padding: 0 8px; overflow: hidden;
}
.ob-bar-slot > * + * { margin-left: 8px; }
.ob-bar-clock { -webkit-flex: none; flex: none; font-size: 14px; color: var(--ob-muted); margin: 0 6px 0 4px; font-variant-numeric: tabular-nums; }
.ob-bar-conn { -webkit-flex: none; flex: none; width: 9px; height: 9px; border-radius: 5px; margin: 0 8px; background: var(--ob-danger); }
.ob-bar-conn.is-on { background: var(--ob-ok); }
.ob-bar-btn .ob-badge { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; line-height: 16px; font-size: 10px; padding: 0 4px; }
.ob-bar-btn { position: relative; }

#ob-views { position: absolute; top: var(--ob-bar-h); right: 0; bottom: 0; left: 0; }
.ob-view { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: none; overflow: hidden; background: var(--ob-bg); }
.ob-view.is-on { display: block; -webkit-animation: ob-fade .14s ease-out; animation: ob-fade .14s ease-out; }

/* immersive mode (api.setFullscreen(true)): bar hidden, small handle to bring it back */
#ob-stage.is-full #ob-bar { display: none; }
#ob-stage.is-full #ob-views { top: 0; }
#ob-full-handle {
  display: none; position: absolute; top: 0; right: 0; z-index: 3; width: 44px; height: 44px; padding: 0;
  border: 0; border-bottom-left-radius: 14px; background: rgba(16, 20, 29, .72); color: var(--ob-text-2);
  -webkit-appearance: none; appearance: none;
}
#ob-full-handle svg { width: 22px; height: 22px; display: block; margin: 0 auto; }
#ob-stage.is-full #ob-full-handle { display: block; }

/* ---------- switcher ---------- */

#ob-switcher { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 40; display: none; }
#ob-switcher.is-on { display: block; }
.ob-switcher-panel {
  position: absolute; top: 54px; right: 8px; width: 330px; max-width: 94%; max-height: 82%;
  background: var(--ob-surface-2); border: 1px solid var(--ob-line); border-radius: 16px;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  -webkit-transform-origin: 100% 0; transform-origin: 100% 0;
  -webkit-animation: ob-pop .14s ease-out; animation: ob-pop .14s ease-out;
}
#ob-stage.is-full ~ #ob-switcher .ob-switcher-panel { top: 50px; }
@-webkit-keyframes ob-pop { from { opacity: 0; -webkit-transform: scale(.94); } to { opacity: 1; -webkit-transform: scale(1); } }
@keyframes ob-pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
.ob-switcher-head { padding: 12px 16px 6px; font-size: 12px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: var(--ob-muted); }
.ob-sw-item { display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; min-height: 56px; padding: 6px 8px 6px 14px; }
.ob-sw-item.is-pressed { background: var(--ob-surface-3); }
.ob-sw-item.is-current .ob-sw-title { color: var(--ob-accent); }
.ob-sw-icon {
  -webkit-flex: none; flex: none; width: 38px; height: 38px; border-radius: 19px; margin-right: 12px; color: #fff;
  display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
}
.ob-sw-icon svg { width: 20px; height: 20px; display: block; }
.ob-sw-main { -webkit-flex: 1 1 0%; flex: 1 1 0%; min-width: 0; }
.ob-sw-title { font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ob-sw-sub { font-size: 12px; color: var(--ob-muted); }
.ob-sw-close {
  -webkit-flex: none; flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 22px; background: transparent; color: var(--ob-muted);
  -webkit-appearance: none; appearance: none;
}
.ob-sw-close svg { width: 18px; height: 18px; display: block; margin: 0 auto; }
.ob-sw-close.is-pressed { background: var(--ob-surface-3); color: var(--ob-danger); }
.ob-sw-item .ob-badge { margin-right: 6px; }

/* ---------- overlays ---------- */

#ob-toasts {
  position: absolute; left: 0; right: 0; bottom: 26px; z-index: 90; pointer-events: none;
  display: -webkit-flex; display: flex; -webkit-flex-direction: column; flex-direction: column;
  -webkit-align-items: center; align-items: center;
}

.ob-app-error { padding: 40px 24px; text-align: center; color: var(--ob-text-2); }
.ob-app-error pre { text-align: left; white-space: pre-wrap; font-family: var(--ob-mono); font-size: 13px; color: var(--ob-danger); background: var(--ob-surface); padding: 12px; border-radius: 10px; margin: 16px auto; max-width: 640px; }

@media (max-width: 800px) {
  .ob-home-head { padding: 26px 28px 0; }
  .ob-home-scroll { padding: 10px 18px 40px; }
  .ob-clock { font-size: 58px; }
}
