/* ============================================================
   Spatial portfolio · UI components (visionOS language)
   Every window, widget and ornament is composed from these.
   Owners may extend in their own files; don't redefine them.

   Material notes
   · Glass = dark frosted tint + a faint sheen lit by the current
     environment light (--vx-env-light, set by env.js) + a 1px
     specular rim (::before) that leans toward the pointer
     (--vx-lx / --vx-ly, set by ui.js) + neutral soft shadows.
   · .vx-glass::before is reserved for the rim, .vx-hover::after
     for the gaze glow. Use other pseudo elements in your files.
   ============================================================ */

@property --vx-lx { syntax: '<percentage>'; inherits: true; initial-value: 50%; }
@property --vx-ly { syntax: '<percentage>'; inherits: true; initial-value: 0%; }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { background: rgb(var(--vx-ground)); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body.vx {
  font-family: var(--vx-font); font-size: 16px; line-height: 1.5; letter-spacing: -0.011em;
  color: var(--vx-label-1); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  font-feature-settings: "ss01" 0, "cv11" 1;
  overflow: hidden; overscroll-behavior: none;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
::selection { background: rgb(255 255 255 / 0.3); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Glass ---------- */
:where(.vx-glass) { position: relative; }
.vx-glass {
  background:
    linear-gradient(180deg, rgb(var(--vx-env-light) / var(--vx-sheen-a)) 0%, rgb(var(--vx-env-light) / 0) 42%),
    radial-gradient(120% 70% at 50% 110%, rgb(0 0 0 / 0.1), transparent 60%),
    rgb(var(--vx-glass) / var(--vx-glass-a));
  -webkit-backdrop-filter: blur(var(--vx-blur)) saturate(var(--vx-sat)) brightness(var(--vx-bright));
  backdrop-filter: blur(var(--vx-blur)) saturate(var(--vx-sat)) brightness(var(--vx-bright));
  box-shadow: inset 0 1px 0 var(--vx-edge-top), inset 0 0 0 1px var(--vx-edge), inset 0 -1px 0 rgb(255 255 255 / 0.04), var(--vx-shadow);
}
.vx-glass--strong { --vx-glass-a: var(--vx-glass-strong-a); }
.vx-glass--flat { -webkit-backdrop-filter: none; backdrop-filter: none; --vx-glass-a: 0.86; }

/* Specular rim: a hairline ring, brightest along the top edge and on the side facing the pointer */
.vx-glass:not([data-win^="title:"])::before {
  content: ""; position: absolute; inset: 0; z-index: 2; border-radius: inherit; padding: 1px; pointer-events: none;
  background:
    radial-gradient(90% 70% at var(--vx-lx) var(--vx-ly), rgb(255 255 255 / var(--vx-rim-hi)), transparent 70%),
    linear-gradient(180deg, rgb(255 255 255 / 0.3), rgb(255 255 255 / 0.06) 38%, rgb(255 255 255 / 0.03) 70%, rgb(255 255 255 / 0.1));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}

/* ---------- Window ----------
   <section class="vx-window vx-glass" data-win="id">
     <div class="vx-window__body"> … </div>
     <nav class="vx-tabbar vx-glass">…</nav>            (optional, leading edge)
     <div class="vx-ornament vx-glass">…</div>          (optional, below)
     <div class="vx-winbar"><button class="vx-close">…</button><span class="vx-grabber"></span></div>
   </section> */
.vx-window { position: absolute; border-radius: var(--vx-r-window); color: var(--vx-label-1); }
.vx-window__body { position: relative; height: 100%; overflow: hidden auto; border-radius: inherit; padding: 40px 44px; scrollbar-width: none; overscroll-behavior: contain; }
.vx-window__body::-webkit-scrollbar { display: none; }

/* Window bar: grabber capsule + close button, floating under the window */
.vx-winbar { position: absolute; left: 50%; bottom: -34px; translate: -50% 0; display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.vx-grabber {
  width: 96px; height: 10px; border-radius: var(--vx-r-pill); cursor: grab; touch-action: none;
  background: rgb(255 255 255 / 0.42);
  box-shadow: inset 0 0.5px 0 rgb(255 255 255 / 0.5), 0 2px 10px rgb(0 0 0 / 0.25);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  transition: background .2s, width .45s var(--vx-spring), scale .35s var(--vx-spring);
}
.vx-grabber:hover, .vx-window.is-dragging .vx-grabber { background: rgb(255 255 255 / 0.82); width: 124px; }
.vx-window.is-dragging .vx-grabber { cursor: grabbing; scale: 1 1.2; }
.vx-close {
  width: 24px; height: 24px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer;
  background: rgb(255 255 255 / 0.5); color: rgb(20 20 24);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: inset 0 0.5px 0 rgb(255 255 255 / 0.6), 0 2px 10px rgb(0 0 0 / 0.25);
  opacity: 0; scale: 0.6; transition: opacity .2s, scale .4s var(--vx-spring), background .2s;
}
.vx-close::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; }
.vx-close { position: relative; }
.vx-close:hover { background: rgb(255 255 255 / 0.9); }
.vx-close:active { scale: 0.86; }
.vx-window:hover .vx-close, .vx-window:focus-within .vx-close, .vx-close:focus-visible { opacity: 1; scale: 1; }
.vx-close svg { width: 10px; height: 10px; }
@media (hover: none) { .vx-close { opacity: 1; scale: 1; } }

/* Vertical tab bar (leading edge, outside the window) */
.vx-tabbar { position: absolute; left: -76px; top: 50%; translate: 0 -50%; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: var(--vx-r-pill); }
.vx-tab { position: relative; width: var(--vx-tab); height: var(--vx-tab); border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; color: var(--vx-label-2); cursor: pointer; transition: background .25s, color .2s, scale .4s var(--vx-spring); }
.vx-tab:hover { background: var(--vx-fill); color: var(--vx-label-1); }
.vx-tab:active { scale: 0.9; }
.vx-tab.is-active, .vx-tab[aria-selected="true"] { background: var(--vx-fill-hi); color: var(--vx-label-1); box-shadow: inset 0 0.5px 0 rgb(255 255 255 / 0.3); }
.vx-tab svg { width: 20px; height: 20px; }
.vx-tab__label {
  position: absolute; left: calc(100% + 14px); top: 50%; translate: 0 -50%; white-space: nowrap; padding: 6px 12px; border-radius: var(--vx-r-pill);
  font-size: 13px; font-weight: 500; color: var(--vx-label-1);
  background: rgb(var(--vx-glass) / 0.82); -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
  box-shadow: inset 0 0.5px 0 rgb(255 255 255 / 0.3), var(--vx-shadow-sm);
  opacity: 0; pointer-events: none; transition: opacity .2s, translate .35s var(--vx-spring);
}
.vx-tab:hover .vx-tab__label, .vx-tab:focus-visible .vx-tab__label { opacity: 1; translate: 4px -50%; }

/* Ornament (toolbar floating below or beside a window) */
.vx-ornament { position: absolute; left: 50%; bottom: -86px; translate: -50% 0; display: flex; align-items: center; gap: 6px; padding: 8px; border-radius: var(--vx-r-pill); }

/* ---------- Buttons ---------- */
.vx-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px;
  border-radius: var(--vx-r-pill); border: 0; background: var(--vx-fill); color: var(--vx-label-1);
  font-size: 15px; font-weight: 500; letter-spacing: -0.01em; cursor: pointer; white-space: nowrap; overflow: hidden; isolation: isolate;
  box-shadow: inset 0 0.5px 0 rgb(255 255 255 / 0.16);
  transition: background .25s, scale .45s var(--vx-spring), box-shadow .25s;
}
.vx-btn:hover { background: var(--vx-fill-hi); scale: 1.03; }
.vx-btn:active { scale: 0.95; transition-duration: .12s, .12s, .12s; }
.vx-btn--prominent { background: rgb(255 255 255 / 0.94); color: rgb(18 18 22); box-shadow: 0 6px 20px -8px rgb(0 0 0 / 0.45); }
.vx-btn--prominent:hover { background: #fff; }
.vx-btn svg { width: 18px; height: 18px; flex: none; }
.vx-icon-btn { width: 44px; height: 44px; padding: 0; border-radius: 50%; }

/* Press ripple (SPACE.ui.ripple): a soft light bloom from the touch point */
.vx-ripple { position: absolute; left: var(--rx); top: var(--ry); width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; pointer-events: none; z-index: -1; background: radial-gradient(closest-side, rgb(255 255 255 / 0.5), rgb(255 255 255 / 0)); animation: vx-ripple .6s var(--vx-ease-out) forwards; }
.vx-btn--prominent .vx-ripple { background: radial-gradient(closest-side, rgb(0 0 0 / 0.14), rgb(0 0 0 / 0)); }
@keyframes vx-ripple { from { transform: scale(1); opacity: 1; } to { transform: scale(var(--rs, 40)); opacity: 0; } }

/* ---------- Typography ---------- */
.vx-large-title { font-size: 40px; line-height: 1.08; font-weight: 700; letter-spacing: -0.025em; margin: 0; text-wrap: balance; }
.vx-title1 { font-size: 29px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
.vx-title2 { font-size: 22px; line-height: 1.2; font-weight: 600; letter-spacing: -0.015em; margin: 0; }
.vx-headline { font-size: 17px; line-height: 1.3; font-weight: 600; margin: 0; }
.vx-body { font-size: 16px; line-height: 1.55; color: var(--vx-label-2); margin: 0; text-wrap: pretty; }
.vx-callout { font-size: 15px; line-height: 1.5; color: var(--vx-label-2); }
.vx-caption { font-size: 13px; line-height: 1.4; color: var(--vx-label-3); }
.vx-eyebrow { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--vx-label-3); }
.vx-secondary { color: var(--vx-label-2); }
.vx-mono { font-family: var(--vx-mono); font-size: 0.92em; letter-spacing: 0; }
.vx-kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; font: 500 12px/1 var(--vx-font); color: var(--vx-label-1); background: var(--vx-fill); box-shadow: inset 0 -1px 0 rgb(0 0 0 / 0.25), inset 0 0.5px 0 rgb(255 255 255 / 0.2); }

/* ---------- Content blocks ---------- */
.vx-platter { background: var(--vx-platter); border-radius: var(--vx-r-card); padding: 20px 22px; box-shadow: inset 0 0.5px 0 rgb(255 255 255 / 0.08); }
a.vx-platter, button.vx-platter { display: block; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: background .25s, translate .45s var(--vx-spring), scale .45s var(--vx-spring), box-shadow .25s; }
a.vx-platter:hover, button.vx-platter:hover { background: var(--vx-platter-hi); translate: 0 -2px; box-shadow: inset 0 0.5px 0 rgb(255 255 255 / 0.14), 0 14px 30px -18px rgb(0 0 0 / 0.5); }
a.vx-platter:active, button.vx-platter:active { scale: 0.98; translate: 0 0; }
.vx-list { background: var(--vx-platter); border-radius: var(--vx-r-card); overflow: hidden; box-shadow: inset 0 0.5px 0 rgb(255 255 255 / 0.08); }
.vx-row { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 12px 20px; }
.vx-row + .vx-row { box-shadow: inset 0 1px 0 var(--vx-hairline); }
a.vx-row, button.vx-row { width: 100%; border: 0; background: none; text-align: left; cursor: pointer; transition: background .2s; }
a.vx-row:hover, button.vx-row:hover { background: rgb(255 255 255 / 0.06); }
a.vx-row:active, button.vx-row:active { background: rgb(255 255 255 / 0.1); }
.vx-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: var(--vx-r-pill); background: var(--vx-fill); font-size: 13px; font-weight: 500; color: var(--vx-label-1); box-shadow: inset 0 0.5px 0 rgb(255 255 255 / 0.12); white-space: nowrap; }
.vx-chip svg { width: 15px; height: 15px; }
.vx-divider { height: 1px; border: 0; margin: 20px 0; background: var(--vx-hairline); }
.vx-ico { width: 20px; height: 20px; flex: none; overflow: visible; }

/* Hover highlight (visionOS "gaze" glow), driven by --mx/--my from ui.js */
.vx-hover { position: relative; }
.vx-hover::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; background: radial-gradient(var(--vx-gaze-r, 160px) circle at var(--mx, 50%) var(--my, 50%), rgb(255 255 255 / 0.16), transparent 70%); transition: opacity .3s; }
.vx-hover:hover::after { opacity: 1; }
@media (hover: none) { .vx-hover::after { display: none; } }

/* Focus: a bright ring that follows the shape, with a soft halo */
:focus { outline: none; }
:focus-visible { outline: 2.5px solid rgb(255 255 255 / 0.95); outline-offset: 3px; }
.vx-btn:focus-visible, .vx-tab:focus-visible, .vx-chip:focus-visible { outline-offset: 2px; box-shadow: 0 0 0 6px rgb(255 255 255 / 0.16); }

/* Hidden scrollbars anywhere inside the space */
.vx-scroll { overflow: auto; scrollbar-width: none; overscroll-behavior: contain; }
.vx-scroll::-webkit-scrollbar { display: none; }

/* No script */
.vx-noscript { max-width: 640px; margin: 12vh auto; padding: 32px; border-radius: 32px; background: rgb(30 30 36 / 0.9); color: #fff; font-family: var(--vx-font); }
.vx-noscript a { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  .vx-btn:hover { scale: 1; }
}
@media (prefers-contrast: more) {
  :root, html.dark { --vx-glass-a: 0.88; --vx-label-2: rgb(255 255 255 / 0.88); --vx-label-3: rgb(255 255 255 / 0.8); }
}

/* Drag to scroll (js/space/ui.js): while a mouse drags a horizontal rail */
.vx-dragscroll { cursor: grabbing; user-select: none; -webkit-user-select: none; scroll-behavior: auto !important; }
.vx-dragscroll * { pointer-events: none; }
