/* ValutrixOS v3 OS-style home — additive. 2026-11-09 America/Chicago.
   Leather / gold / cosmic desktop + phone home. No new libraries.
   Rollback: remove this file and its <link> in index.html. */

:root {
  --vxos-gold: #E8C26A;
  --vxos-gold-bright: #F1BA1F;
  --vxos-ink: #0A0A0F;
  --vxos-bar: var(--vx-os-bar, 44px);
  --vxos-dock: 72px;
  --vxos-ease: cubic-bezier(.2, .8, .2, 1);
}

/* ---------- Boot / sign-in (skippable, never clips the mark) ---------- */
#vxOsBoot {
  position: fixed;
  inset: 0;
  z-index: 2147483640;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 20px calc(24px + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% -10%, #2a1d0c 0%, #0A0A0F 55%, #000 100%);
  color: #F3E7C9;
  text-align: center;
}
#vxOsBoot[hidden] { display: none !important; }
#vxOsBoot .vxos-boot-stage {
  position: relative;
  width: min(100%, 440px);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: visible;
}
#vxOsBoot .vxos-boot-mark {
  width: min(36vw, 128px);
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  object-position: center;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 0 28px rgba(241, 186, 31, .5));
  opacity: 0;
  transform: scale(.82);
}
#vxOsBoot .vxos-boot-lockup {
  width: min(88vw, 420px);
  max-width: 100%;
  height: auto;
  max-height: 64px;
  object-fit: contain;
  object-position: center;
  display: block;
  margin: 18px auto 0;
  overflow: visible;
  opacity: 0;
  transform: translateY(8px);
}
#vxOsBoot .vxos-boot-skip {
  position: absolute;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  min-height: 44px;
  min-width: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(212, 168, 87, .4);
  background: rgba(10, 8, 6, .6);
  color: #F3E7C9;
  font: 600 14px/1 Inter, system-ui, sans-serif;
  cursor: pointer;
  opacity: 0;
}
#vxOsBoot.vxos-play .vxos-boot-mark {
  animation: vxosBootMark .7s var(--vxos-ease) .05s forwards;
}
#vxOsBoot.vxos-play .vxos-boot-lockup {
  animation: vxosBootLockup .6s var(--vxos-ease) .55s forwards;
}
#vxOsBoot.vxos-play .vxos-boot-skip {
  animation: vxosBootSkip .3s ease .5s forwards;
}
#vxOsBoot.vxos-out { opacity: 0; transition: opacity .35s ease; pointer-events: none; }
@keyframes vxosBootMark {
  from { opacity: 0; transform: scale(.82); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes vxosBootLockup {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes vxosBootSkip { to { opacity: 1; } }

/* Existing cinematic intro: use the square mark, never clip at 390px */
#xr-intro .xr-logo {
  width: min(42vw, 160px) !important;
  height: auto !important;
  max-height: min(36vh, 180px) !important;
  object-fit: contain !important;
  object-position: center center !important;
  overflow: visible !important;
  filter: drop-shadow(0 0 24px rgba(241, 186, 31, .55)) !important;
  top: 50% !important;
  left: 50% !important;
}
#xr-intro .xr-logo-lockup {
  position: absolute;
  left: 50%;
  top: calc(50% + min(22vw, 100px));
  width: min(84vw, 380px);
  max-height: 56px;
  height: auto;
  object-fit: contain;
  object-position: center;
  transform: translateX(-50%);
  opacity: 0;
  filter: drop-shadow(0 0 16px rgba(241, 186, 31, .35));
  overflow: visible;
  pointer-events: none;
}
#xr-intro.xr-play .xr-logo-lockup {
  animation: vxosBootLockup .7s var(--vxos-ease) 2.7s forwards;
}

/* ---------- Shell ---------- */
#vxOsHome {
  position: fixed;
  inset: 0;
  z-index: 8500;
  display: none;
  flex-direction: column;
  color: #F3E7C9;
  font: 400 14px/1.4 Inter, system-ui, sans-serif;
  overflow: hidden;
  isolation: isolate;
}
html.vx-os-v3.vx-os-desk #vxOsHome { display: flex; }
#vxOsHome .vxos-sky {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}
#vxOsHome .vxos-wallpaper {
  position: absolute;
  inset: -6%;
  z-index: 0;
  pointer-events: none;
  background:
    url("/assets/console/leather-black-v3.jpg") center / cover no-repeat,
    radial-gradient(90% 70% at 50% -10%, rgba(80, 52, 16, .55), transparent 55%),
    radial-gradient(50% 40% at 80% 90%, rgba(212, 168, 87, .12), transparent 50%),
    #0A0A0F;
  transform: translate3d(var(--vxos-px, 0px), var(--vxos-py, 0px), 0);
  will-change: transform;
}
#vxOsHome .vxos-wallpaper::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(10, 10, 15, .35), rgba(10, 10, 15, .2) 35%, rgba(10, 10, 15, .55)),
    radial-gradient(120% 80% at 50% 0%, rgba(241, 186, 31, .08), transparent 50%);
  pointer-events: none;
}
#vxOsHome .vxos-stage {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-top: calc(var(--vxos-bar) + env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--vxos-dock) + 12px + env(safe-area-inset-bottom, 0px));
}

/* Preview banner: honest, no fake session */
#vxOsHome .vxos-banner {
  position: relative;
  z-index: 2;
  margin: 8px 12px 0;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(212, 168, 87, .3);
  background: rgba(12, 10, 8, .72);
  color: #E8C26A;
  font: 600 12px/1.4 Inter, system-ui, sans-serif;
  text-align: center;
}

/* Greeting + clock on the desktop (time-of-day, America/Chicago) */
#vxOsHome .vxos-hello {
  position: relative;
  z-index: 2;
  padding: 18px 20px 8px;
  text-align: center;
  pointer-events: none;
}
#vxOsHome .vxos-hello h1 {
  margin: 0;
  font: 600 clamp(22px, 4vw, 36px)/1.15 Cinzel, serif;
  letter-spacing: .04em;
  background: linear-gradient(180deg, #fff, #e8e2d6 45%, #C6851F);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
#vxOsHome .vxos-hello .vxos-hello-time {
  margin: 6px 0 0;
  color: #C9B896;
  font: 500 13px/1.3 Inter, system-ui, sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* Icon grid */
#vxOsHome .vxos-icons {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 18px 12px;
  justify-items: center;
  align-content: start;
  padding: 12px 28px 8px;
  max-width: 880px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  overflow: auto;
  flex: 1;
}
#vxOsHome .vxos-icon {
  appearance: none;
  -webkit-appearance: none;
  width: 88px;
  border: 0;
  background: none;
  color: #F3E7C9;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 4px;
  border-radius: 14px;
  font: 600 11px/1.2 Inter, system-ui, sans-serif;
  letter-spacing: .02em;
  text-align: center;
}
#vxOsHome .vxos-icon:focus-visible {
  outline: 2px solid #F1BA1F;
  outline-offset: 3px;
}
#vxOsHome .vxos-icon-glyph {
  width: 62px;
  height: 62px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(232, 194, 106, .2), rgba(20, 14, 8, .55)),
    rgba(18, 14, 10, .7);
  border: 1px solid rgba(241, 186, 31, .35);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, .45),
    inset 0 1px 0 rgba(255, 236, 190, .2);
  transition: transform .18s var(--vxos-ease), box-shadow .18s ease, filter .18s ease;
  color: #F1BA1F;
}
#vxOsHome .vxos-icon-glyph svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#vxOsHome .vxos-icon:hover .vxos-icon-glyph,
#vxOsHome .vxos-icon:focus-visible .vxos-icon-glyph {
  transform: translateY(-2px) scale(1.04);
  box-shadow:
    0 0 18px rgba(241, 186, 31, .35),
    0 10px 24px rgba(0, 0, 0, .5),
    inset 0 1px 0 rgba(255, 236, 190, .3);
  filter: drop-shadow(0 0 8px rgba(241, 186, 31, .35));
}
#vxOsHome .vxos-icon:active .vxos-icon-glyph {
  transform: scale(.94);
  filter: none;
}
#vxOsHome .vxos-icon-label { max-width: 88px; word-break: break-word; }
#vxOsHome .vxos-icon[hidden] { display: none !important; }

/* Windows layer */
#vxOsWins {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}
.vxos-win {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 280px;
  min-height: 200px;
  pointer-events: auto;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(241, 186, 31, .45);
  background:
    linear-gradient(180deg, rgba(40, 30, 16, .55), rgba(12, 10, 8, .78)),
    rgba(14, 11, 8, .72);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow:
    0 0 0 1px rgba(255, 220, 150, .08) inset,
    0 28px 80px rgba(0, 0, 0, .6),
    0 0 40px rgba(212, 168, 87, .08);
  animation: vxosWinIn .28s var(--vxos-ease) both;
}
.vxos-win.vxos-closing { animation: vxosWinOut .2s ease both; }
.vxos-win.vxos-min { animation: vxosWinMin .22s ease both; }
.vxos-win.vxos-max {
  inset: calc(var(--vxos-bar) + env(safe-area-inset-top, 0px) + 6px)
         8px
         calc(var(--vxos-dock) + env(safe-area-inset-bottom, 0px) + 8px)
         8px !important;
  width: auto !important;
  height: auto !important;
  border-radius: 10px;
}
.vxos-win.is-front { z-index: 6; }
@keyframes vxosWinIn {
  from { opacity: 0; transform: scale(.94) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes vxosWinOut {
  to { opacity: 0; transform: scale(.94) translateY(10px); }
}
@keyframes vxosWinMin {
  to { opacity: 0; transform: scale(.4) translateY(80px); }
}
.vxos-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 8px 0 12px;
  background:
    linear-gradient(180deg, rgba(50, 38, 18, .9), rgba(18, 14, 10, .88));
  border-bottom: 1px solid rgba(212, 168, 87, .28);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.vxos-titlebar:active { cursor: grabbing; }
.vxos-titlebar .vxos-win-title {
  flex: 1;
  min-width: 0;
  font: 600 12px/1 Inter, system-ui, sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #E8C26A;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vxos-win-btns { display: flex; gap: 4px; }
.vxos-win-btns button {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(212, 168, 87, .28);
  background: rgba(0, 0, 0, .35);
  color: #F3E7C9;
  cursor: pointer;
  font: 700 12px/1 system-ui, sans-serif;
  padding: 0;
}
.vxos-win-btns button:hover { border-color: #F1BA1F; background: rgba(241, 186, 31, .15); }
.vxos-win-btns button:focus-visible { outline: 2px solid #F1BA1F; outline-offset: 1px; }
.vxos-win-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: rgba(8, 7, 6, .45);
  -webkit-overflow-scrolling: touch;
}
.vxos-win-body iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 280px;
  border: 0;
  background: #0A0A0F;
}
.vxos-empty {
  margin: 24px;
  color: #C9B896;
  font-size: 14px;
}

/* When an existing screen is hosted as a window */
html.vx-os-v3.vx-os-desk .screen.active.vxos-hosted {
  position: fixed !important;
  z-index: 8600 !important;
  margin: 0 !important;
  border-radius: 0 0 12px 12px !important;
  border: 0 !important;
  box-shadow: none !important;
  min-height: 0 !important;
  padding-top: 0 !important;
  overflow: auto !important;
}
html.vx-os-v3.vx-os-desk .screen.active.vxos-hosted::before { display: none !important; }
html.vx-os-v3.vx-os-desk .mobile-bottom-bar { display: none !important; }
html.vx-os-v3.vx-os-desk #xp-si-open { display: none !important; }
html.vx-os-v3.vx-os-desk #screen-dashboard { display: none !important; }

/* Hosted screen sits under our window chrome; JS sets --vxos-win-* */
html.vx-os-v3.vx-os-desk .screen.active.vxos-hosted {
  top: var(--vxos-win-t, 120px);
  left: var(--vxos-win-l, 80px);
  width: var(--vxos-win-w, 720px);
  height: var(--vxos-win-h, 480px);
}

/* Top bar mark — square mark on phone so the lockup never clips under the 44px bar */
#vxMainOsBar .vxos-bar-mark {
  height: 22px;
  width: 22px;
  flex: none;
  object-fit: contain;
  object-position: center;
  display: block;
  overflow: visible;
  margin-right: 2px;
}
#vxMainOsBar .vxos-bar-lockup {
  height: 22px;
  width: auto;
  max-width: min(220px, 28vw);
  object-fit: contain;
  object-position: left center;
  display: block;
  overflow: visible;
}
@media (max-width: 600px) {
  html.vx-main-os.in-app #vxMainOsBar .vxos-bar-mark {
    height: 16px;
    width: 16px;
    margin-right: 4px;
    align-self: center;
  }
  /* 2026-11-10 overlay-fix: keep a height-capped lockup visible on phone (was hidden, which made the top logo disappear). */
  #vxMainOsBar .vxos-bar-lockup { display: block !important; height: 16px; width: auto; max-width: min(160px, 48vw); object-fit: contain; object-position: left center; overflow: visible; }
  #vxMainOsBar > .logo {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
  }
}

/* ---------- Dock / taskbar ---------- */
#vxOsDock {
  position: fixed;
  left: 50%;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 8700;
  display: none;
  align-items: flex-end;
  gap: 4px;
  padding: 8px 10px 8px;
  max-width: calc(100vw - 16px);
  background: rgba(14, 12, 10, .78);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(212, 168, 87, .32);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .55), 0 0 24px rgba(212, 168, 87, .08);
}
html.vx-os-v3.vx-os-desk #vxOsDock { display: flex; }
#vxOsDock .vxos-dock-item {
  appearance: none;
  border: 0;
  background: none;
  color: #F3E7C9;
  width: 48px;
  height: 48px;
  padding: 0;
  margin: 0 2px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  transform-origin: bottom center;
  transition: transform .16s var(--vxos-ease);
}
#vxOsDock .vxos-dock-item img,
#vxOsDock .vxos-dock-item .vxos-dock-glyph {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: contain;
  background:
    linear-gradient(180deg, rgba(232, 194, 106, .18), rgba(10, 8, 6, .5));
  border: 1px solid rgba(212, 168, 87, .28);
  box-shadow: inset 0 1px 0 rgba(255, 236, 190, .18);
}
#vxOsDock .vxos-dock-item .vxos-dock-glyph {
  display: grid;
  place-items: center;
  color: #F1BA1F;
}
#vxOsDock .vxos-dock-item .vxos-dock-glyph svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#vxOsDock .vxos-dock-item:hover,
#vxOsDock .vxos-dock-item:focus-visible {
  filter: drop-shadow(0 0 10px rgba(241, 186, 31, .45));
}
#vxOsDock .vxos-dock-item:focus-visible { outline: 2px solid #F1BA1F; outline-offset: 2px; }
#vxOsDock .vxos-dock-item:active { transform: scale(.92) !important; }
#vxOsDock .vxos-dock-item.is-running::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #F1BA1F;
  transform: translateX(-50%);
}
#vxOsDock .vxos-dock-clock {
  margin-left: 8px;
  padding: 0 10px;
  min-width: 72px;
  color: #F3E7C9;
  font: 600 12px/1.1 Inter, system-ui, sans-serif;
  letter-spacing: .04em;
  text-align: right;
  align-self: center;
  white-space: nowrap;
}
#vxOsDock .vxos-dock-clock small {
  display: block;
  color: #9C968B;
  font: 500 9px/1 Inter, system-ui, sans-serif;
  letter-spacing: .1em;
  text-transform: uppercase;
}
#vxOsDock .vxos-tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font: 500 11px Inter, system-ui, sans-serif;
  letter-spacing: .06em;
  background: #0b0a08;
  border: 1px solid rgba(212, 168, 87, .4);
  color: #F3E7C9;
  padding: 4px 8px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}
@media (hover: hover) {
  #vxOsDock .vxos-dock-item:hover .vxos-tip { opacity: 1; }
}
#vxOsDock .vxos-dock-item:focus-visible .vxos-tip { opacity: 1; }

/* ---------- Phone home (390-wide) ---------- */
@media (max-width: 767px) {
  html.vx-os-v3.vx-os-desk #vxOsHome .vxos-icons {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px 8px;
    padding: 8px 16px 12px;
    max-width: none;
  }
  html.vx-os-v3.vx-os-desk #vxOsHome .vxos-icon { width: 100%; }
  html.vx-os-v3.vx-os-desk #vxOsHome .vxos-icon-glyph { width: 58px; height: 58px; border-radius: 14px; }
  html.vx-os-v3.vx-os-desk #vxOsDock {
    left: 10px;
    right: 10px;
    transform: none;
    width: auto;
    max-width: none;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
    border-radius: 16px;
    padding: 6px 8px;
  }
  html.vx-os-v3.vx-os-desk #vxOsDock::-webkit-scrollbar { display: none; }
  html.vx-os-v3.vx-os-desk #vxOsDock .vxos-dock-clock { margin-left: auto; }
  html.vx-os-v3.vx-os-desk #vxOsDock .vxos-dock-item { width: 44px; height: 44px; }
  /* Phone apps go full-screen; windows lose desktop chrome drag affordance */
  html.vx-os-v3.vx-os-phone-app #vxOsHome .vxos-icons,
  html.vx-os-v3.vx-os-phone-app #vxOsHome .vxos-hello,
  html.vx-os-v3.vx-os-phone-app #vxOsHome .vxos-banner { display: none !important; }
  html.vx-os-v3.vx-os-phone-app .vxos-win,
  html.vx-os-v3.vx-os-phone-app .screen.active.vxos-hosted {
    inset: calc(var(--vxos-bar) + env(safe-area-inset-top, 0px)) 0 calc(58px + env(safe-area-inset-bottom, 0px)) 0 !important;
    width: auto !important;
    height: auto !important;
    left: 0 !important;
    top: calc(var(--vxos-bar) + env(safe-area-inset-top, 0px)) !important;
    border-radius: 0 !important;
    animation: vxosPhoneIn .28s var(--vxos-ease) both;
  }
  @keyframes vxosPhoneIn {
    from { opacity: .4; transform: translateX(28px); }
    to { opacity: 1; transform: translateX(0); }
  }
  .vxos-home-bar {
    position: fixed;
    left: 50%;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 8800;
    width: 128px;
    height: 5px;
    border-radius: 999px;
    background: rgba(243, 231, 201, .55);
    border: 0;
    padding: 0;
    cursor: pointer;
  }
  .vxos-home-bar:focus-visible { outline: 2px solid #F1BA1F; outline-offset: 6px; }
  html.vx-os-v3.vx-os-phone-app #vxOsDock { display: none; }
  html.vx-os-v3.vx-os-desk .vxos-titlebar { cursor: default; }
}
html:not(.vx-os-phone-app) .vxos-home-bar { display: none; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  #vxOsBoot.vxos-play .vxos-boot-mark,
  #vxOsBoot.vxos-play .vxos-boot-lockup,
  #vxOsBoot.vxos-play .vxos-boot-skip,
  #xr-intro.xr-play .xr-logo-lockup,
  .vxos-win,
  html.vx-os-v3.vx-os-phone-app .vxos-win,
  html.vx-os-v3.vx-os-phone-app .screen.active.vxos-hosted,
  #vxOsHome .vxos-icon-glyph,
  #vxOsDock .vxos-dock-item {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  #vxOsHome .vxos-wallpaper { transform: none !important; }
}
