/* The 3D office: the canvas, the labels over agents, the toolbar, the agent panel, the preview
   panel and the caption. The scene itself is drawn by WebGL; this file only styles the overlay. */

.o3 { position: relative; width: 100%; height: clamp(440px, 64vh, 780px); border-radius: 16px; overflow: hidden; background: #15122a; color: #f4f0ff; font-size: 13px; isolation: isolate; }
.o3-immersive, .home #home-office:has(.o3) .o3 { height: 100%; border-radius: 0; }
.home #home-office:has(.o3) { width: 100%; }
.home:has(.o3) .hud-status { display: none; }
.o3-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.o3-canvas:active { cursor: grabbing; }

/* labels over each agent */
.o3-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.o3-label { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; pointer-events: auto; will-change: transform; }
.o3-name { padding: 2px 8px; border-radius: 99px; background: rgba(21, 18, 42, .78); border: 1px solid color-mix(in srgb, var(--c) 70%, transparent); font-size: 11px; font-weight: 700; white-space: nowrap; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-shadow: 0 0 0 0 var(--c); transition: box-shadow .2s; }
.o3-label.sel .o3-name { box-shadow: 0 0 0 2px var(--c); }
.o3-pill { order: -1; padding: 1px 7px; border-radius: 99px; font-size: 10px; font-weight: 700; letter-spacing: .02em; background: #4a4370; color: #e8e2ff; }
.o3-pill.st-idle { display: none; }
.o3-label .o3-pill.st-idle { display: none; }
.o3-panel .o3-pill.st-idle { display: inline-block; }
.st-working { background: #6c5ce7 !important; color: #fff !important; }
.st-researching { background: #2f8fd8 !important; color: #fff !important; }
.st-success { background: #22b37a !important; color: #fff !important; }
.st-waiting { background: #ffb020 !important; color: #1d1500 !important; }
.st-error { background: #e5484d !important; color: #fff !important; }
.st-paused { background: #77748f !important; color: #fff !important; }
.o3-bubble { order: -2; max-width: 190px; padding: 5px 9px; border-radius: 10px; background: rgba(255, 255, 255, .94); color: #2a2245; font-size: 11px; line-height: 1.3; text-align: center; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); animation: o3-pop .35s cubic-bezier(.3, 1.5, .5, 1); }
.o3-bubble[hidden] { display: none; }

/* the top bar: mode and tools */
.o3-top { position: absolute; left: 12px; top: 12px; right: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; pointer-events: none; z-index: 5; }
.o3-immersive .o3-top { left: 16px; top: 14px; right: 140px; }
.o3-mode, .o3-tools { pointer-events: auto; }
.o3-mode, .o3-seg, .o3-btn, .o3-stats { box-shadow: 0 6px 18px rgba(0, 0, 0, .22); border: 1px solid rgba(255, 255, 255, .06); }
.o3-mode { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 12px; border-radius: 99px; background: rgba(24, 24, 28, .82); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-weight: 600; }
.o3-mode span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o3-roam { pointer-events: auto; max-width: min(520px, 100%); padding: 6px 12px; border-radius: 14px; background: rgba(60, 40, 8, .86); color: #ffd18f; font-size: 12px; line-height: 1.35; }
.o3-roam[hidden] { display: none; }
/* live counts along the bottom, so the room's state reads at a glance */
.o3-stats { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 5; display: flex; gap: 14px; padding: 7px 16px; border-radius: 99px; background: rgba(24, 24, 28, .82); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #8f8a82; white-space: nowrap; pointer-events: none; }
.o3-stats b { color: #f4f2ef; font-weight: 700; margin-right: 3px; }
.o3-stats i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.o3-stats .s-work i { background: #2fd27c; } .o3-stats .s-free i { background: #d8d4cc; } .o3-stats .s-wait i { background: #ffb020; } .o3-stats .s-done i { background: #8fd3ff; } .o3-stats .s-bad i { background: #ff6b81; }
@media (max-width: 640px) { .o3-stats { gap: 10px; padding: 6px 12px; font-size: 10px; } }
.o3-mode i { width: 8px; height: 8px; border-radius: 50%; background: #9aa3c4; flex: none; }
.o3-mode.m-live.on i { background: #2fd27c; box-shadow: 0 0 0 0 rgba(47, 210, 124, .6); animation: o3-ping 1.6s infinite; }
.o3-mode.m-sim { background: rgba(90, 62, 6, .88); }
.o3-mode.m-sim i { background: #ffb020; }
.o3-mode.m-preview { background: rgba(20, 60, 96, .9); }
.o3-mode.m-preview i { background: #8fd3ff; }
.o3-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.o3-seg { display: inline-flex; padding: 3px; border-radius: 99px; background: rgba(24, 24, 28, .82); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.o3-seg button, .o3-btn { padding: 5px 11px; border: 0; border-radius: 99px; background: transparent; color: #d8d4cc; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; transition: background .15s, color .15s; }
.o3-seg button:hover, .o3-btn:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.o3-seg button[aria-pressed="true"] { background: #f4f2ef; color: #1c1c1c; }
.o3-btn { background: rgba(24, 24, 28, .82); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.o3-btn[aria-pressed="true"] { background: rgba(244, 242, 239, .16); color: #fff; box-shadow: inset 0 0 0 1px rgba(244, 242, 239, .55); }
.o3-btn:focus-visible, .o3-seg button:focus-visible, .o3-label:focus-visible .o3-name { outline: 2px solid #f4f2ef; outline-offset: 2px; }

/* the agent panel */
.o3-panel { position: absolute; right: 12px; top: 58px; z-index: 6; width: min(300px, calc(100% - 24px)); padding: 12px 14px; border-radius: 14px; background: rgba(24, 24, 28, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); animation: o3-in .25s ease-out; }
.o3-immersive .o3-panel { top: 72px; right: 16px; }
.o3-panel[hidden] { display: none; }
.o3-panel header { display: flex; align-items: center; gap: 10px; }
.o3-panel header div { flex: 1; display: flex; flex-direction: column; }
.o3-panel header b { font-size: 15px; }
.o3-panel header span { color: #b8aedc; font-size: 12px; }
.o3-panel header button { border: 0; background: none; color: #b8aedc; font-size: 14px; cursor: pointer; }
.o3-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c); flex: none; box-shadow: 0 0 10px var(--c); }
.o3-state { display: flex; align-items: center; gap: 8px; margin: 10px 0 6px; }
.o3-src { color: #b8aedc; font-size: 11px; }
.o3-doing { margin: 6px 0; color: #efeaff; line-height: 1.4; }
.o3-act { margin: 6px 0 10px; color: #d9cff3; line-height: 1.4; }
.o3-act .muted { color: #9a90c0; }
.o3-row { display: flex; gap: 8px; align-items: center; }
.o3-row button, .o3-row a { padding: 6px 12px; border-radius: 99px; border: 0; background: #8b6cff; color: #fff; font: inherit; font-size: 12px; font-weight: 600; text-decoration: none; cursor: pointer; }
.o3-row a { background: rgba(255, 255, 255, .1); }
.o3-row button[aria-pressed="true"] { background: #4b3a86; box-shadow: inset 0 0 0 1px #b49cff; }

/* preview panel */
.o3-preview { position: absolute; left: 12px; top: 96px; bottom: 56px; z-index: 6; width: min(290px, calc(100% - 24px)); overflow: auto; padding: 12px; border-radius: 14px; background: rgba(14, 40, 66, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.o3-preview[hidden] { display: none; }
.o3-preview header { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.o3-preview header span { color: #b9d9f2; font-size: 12px; line-height: 1.35; }
.o3-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.o3-presets button, .o3-exit { padding: 5px 10px; border: 0; border-radius: 99px; background: rgba(255, 255, 255, .12); color: #fff; font: inherit; font-size: 12px; cursor: pointer; }
.o3-preview ul { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.o3-preview li { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 8px; }
.o3-preview label { font-weight: 600; }
.o3-preview select { padding: 3px 6px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .2); background: #0e2236; color: #fff; font: inherit; font-size: 12px; }
.o3-exit { background: #2f8fd8; font-weight: 600; }

/* the speaker's music panel */
.o3-music { position: absolute; right: 12px; top: 58px; z-index: 7; width: min(310px, calc(100% - 24px)); max-height: calc(100% - 130px); overflow: auto; padding: 12px 14px; border-radius: 14px; background: rgba(24, 24, 28, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); animation: o3-in .25s ease-out; }
.o3-immersive .o3-music { top: 72px; right: 16px; }
.o3-music[hidden] { display: none; }
.o3-music header { display: flex; align-items: flex-start; gap: 10px; }
.o3-music header div { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.o3-music header b { font-size: 15px; }
.o3-music header span { color: #c9c4bb; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o3-music header button { border: 0; background: none; color: #c9c4bb; font-size: 14px; cursor: pointer; }
.o3-m-controls { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.o3-m-controls button { padding: 6px 12px; border: 0; border-radius: 99px; background: rgba(244, 242, 239, .12); color: #fff; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.o3-m-controls button[data-act="music-play"] { background: #f4f2ef; color: #1c1c1c; }
.o3-m-controls button:disabled { opacity: .4; cursor: default; }
.o3-music ol { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 2px; }
.o3-music li button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 7px 8px; border: 0; border-radius: 9px; background: none; color: #efece6; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.o3-music li button:hover, .o3-music li button[aria-current="true"] { background: rgba(244, 242, 239, .1); }
.o3-music li button span { width: 18px; flex: none; color: #8a867f; font-size: 11px; text-align: center; }
.o3-music li button.on span { color: #ffd9a8; font-size: 13px; }
.o3-m-note { margin: 6px 0 0; color: #a7a29a; font-size: 12px; line-height: 1.4; }
.o3-m-note b { color: #efece6; }
.o3-m-error { margin: 0 0 8px; padding: 6px 10px; border-radius: 8px; background: rgba(214, 69, 69, .2); color: #ffc9c9; font-size: 12px; }
.o3-music button:focus-visible { outline: 2px solid #f4f2ef; outline-offset: 2px; }

/* caption and loading */
.o3-caption { position: absolute; left: 50%; bottom: 58px; z-index: 4; max-width: min(640px, calc(100% - 32px)); padding: 8px 16px; border-radius: 99px; background: rgba(24, 24, 28, .84); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transform: translate(-50%, 8px); opacity: 0; transition: opacity .3s, transform .3s; pointer-events: none; text-align: center; }
.o3-caption.show { opacity: 1; transform: translate(-50%, 0); }
.o3-immersive .o3-caption { bottom: 70px; }
.o3-immersive .o3-stats { bottom: 20px; }
.o3-loading { position: absolute; inset: 0; z-index: 10; display: grid; place-content: center; justify-items: center; gap: 10px; background: #15122a; color: #cdbfff; }
.o3-spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(180, 156, 255, .25); border-top-color: #b49cff; animation: o3-spin 0.9s linear infinite; }
.o3-fallback-note { margin: 0 0 8px; padding: 8px 12px; border-radius: 10px; background: #fff4d6; color: #5a4210; font-size: 13px; }
.o3-to3d { position: absolute; right: 12px; top: 12px; z-index: 20; padding: 6px 12px; border: 0; border-radius: 99px; background: rgba(21, 18, 42, .82); color: #fff; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
#office-host, #home-office { position: relative; }
.home #home-office .o3-to3d { top: 64px; right: 16px; }

@keyframes o3-pop { from { opacity: 0; transform: translateY(4px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes o3-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes o3-ping { 0% { box-shadow: 0 0 0 0 rgba(47, 210, 124, .6); } 100% { box-shadow: 0 0 0 8px rgba(47, 210, 124, 0); } }
@keyframes o3-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .o3-bubble, .o3-panel, .o3-music { animation: none; } .o3-mode.m-live.on i { animation: none; } }
@media (max-width: 720px) {
  .o3-immersive .o3-top { right: 70px; }
  .o3-seg { max-width: 100%; overflow-x: auto; }
  .o3-panel { top: auto; bottom: 12px; right: 12px; left: 12px; width: auto; }
  .o3-label .o3-bubble { display: none; }
}

/* the gate into the 3D office (gems/gate.js): two doors with the PanScience Innovations mark across the seam */
.gate { --ink: #0d0d0d; --paper: #f4f2ef; --stone: #8a867f; position: fixed; inset: 0; z-index: 9000; overflow: hidden; background: radial-gradient(120% 90% at 50% 40%, #2a2a2e, #121214 70%); perspective: 1800px; cursor: pointer; animation: gate-in .45s ease-out both; }
.gate-light { position: absolute; inset: 0; background: radial-gradient(34% 60% at 50% 50%, rgba(255, 240, 212, .75), rgba(255, 214, 160, .22) 45%, transparent 72%); opacity: 0; transition: opacity .5s ease .1s; }
.gate-frame { position: absolute; inset: 7vh 6vw 9vh; display: flex; transform-style: preserve-3d; border-radius: 26vmin 26vmin 6px 6px; box-shadow: 0 0 0 10px #2e2d30, 0 0 0 12px rgba(244, 242, 239, .14), 0 30px 80px rgba(0, 0, 0, .55); }
.gate-door { position: relative; flex: 1; overflow: hidden; background: linear-gradient(180deg, #2b2a2e, #1d1d20 60%, #18181a); transition: transform 1.25s cubic-bezier(.6, .02, .25, 1); backface-visibility: hidden; }
.gate-l { border-radius: 26vmin 0 0 6px; transform-origin: left center; box-shadow: inset -1px 0 0 rgba(244, 242, 239, .18); }
.gate-r { border-radius: 0 26vmin 6px 0; transform-origin: right center; box-shadow: inset 1px 0 0 rgba(244, 242, 239, .18); }
.gate-panels { position: absolute; inset: 9% 12% 7%; display: grid; grid-template-rows: 2.2fr 1fr 1fr; gap: 3.2%; }
.gate-panels i { border: 1px solid rgba(244, 242, 239, .1); border-radius: 4px; background: linear-gradient(180deg, rgba(255, 255, 255, .025), rgba(0, 0, 0, .12)); }
.gate-l .gate-panels i:first-child { border-top-left-radius: 22vmin; }
.gate-r .gate-panels i:first-child { border-top-right-radius: 22vmin; }
.gate-handle { position: absolute; top: 76%; width: 9px; height: 9vh; border-radius: 9px; background: linear-gradient(90deg, #6d6a65, #c9c4bb, #6d6a65); box-shadow: 0 2px 6px rgba(0, 0, 0, .5); }
.gate-l .gate-handle { right: 4.5%; }
.gate-r .gate-handle { left: 4.5%; }
/* the round plate sits on the seam; each door shows its own half */
.gate-medal { position: absolute; top: 15%; width: min(28vmin, 240px); height: min(28vmin, 240px); display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fbfaf7, var(--paper) 60%, #e3dfd8); box-shadow: 0 0 0 6px #3a393c, 0 0 0 8px rgba(244, 242, 239, .35), 0 14px 40px rgba(0, 0, 0, .5); }
.gate-l .gate-medal { right: calc(min(28vmin, 240px) / -2); }
.gate-r .gate-medal { left: calc(min(28vmin, 240px) / -2); }
.gate-medal svg { height: min(16vmin, 138px); width: auto; overflow: visible; }
.gm-line path { fill: none; stroke: var(--ink); stroke-width: 14; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: gate-draw 1.1s .35s ease-in-out forwards; }
.gm-fill path { fill: var(--ink); opacity: 0; animation: gate-fade .5s 1.15s ease-out forwards; }
.gate-text { position: absolute; left: 50%; top: calc(7vh + 15% + min(28vmin, 240px) + 3.5vh); width: min(94vw, 1100px); transform: translateX(-50%); text-align: center; color: var(--paper); pointer-events: none; transition: opacity .3s, transform .3s; }
.gate-kicker { margin: 0 0 1.6vh; line-height: 0; color: var(--paper); opacity: 0; animation: gate-rise .6s .9s ease-out forwards; }
.gate-text h1 { margin: 0; font: 300 clamp(22px, 4vmin, 42px)/1.15 system-ui, -apple-system, "Helvetica Neue", sans-serif; letter-spacing: .01em; text-shadow: 0 2px 18px rgba(0, 0, 0, .6); opacity: 0; animation: gate-rise .7s 1.1s ease-out forwards; }
.gate-text h1 b { font-weight: 650; }
.gate-word { height: clamp(22px, 4vmin, 40px); width: auto; }
.gate-sub { margin: 1.6vh 0 0; font: 500 clamp(12px, 1.6vmin, 15px)/1 system-ui, sans-serif; color: #c9c4bb; opacity: 0; animation: gate-rise .6s 1.5s ease-out forwards; }
.gate-sub span { animation: gate-dot 1.2s infinite; }
.gate-sub span:nth-child(2) { animation-delay: .2s; }
.gate-sub span:nth-child(3) { animation-delay: .4s; }
.gate-skip { position: absolute; right: 22px; bottom: 20px; padding: 6px 14px; border-radius: 99px; border: 1px solid rgba(244, 242, 239, .3); background: transparent; color: rgba(244, 242, 239, .7); font: inherit; font-size: 12px; cursor: pointer; }
/* opening: the words go, the doors swing in, light spills through, then everything fades into the office */
.gate.open { pointer-events: none; background: transparent; animation: gate-out .5s 1s ease-in forwards; }
.gate.open .gate-frame { box-shadow: none; transition: box-shadow .4s; }
.gate.open .gate-light { animation: gate-out .6s .55s ease-in forwards; }
.gate.open .gate-text, .gate.open .gate-skip { opacity: 0; transform: translateX(-50%) translateY(-8px); }
.gate.open .gate-skip { transform: none; }
.gate.open .gate-l { transform: rotateY(-108deg); }
.gate.open .gate-r { transform: rotateY(108deg); }
.gate.open .gate-light { opacity: 1; }
.gate.calm, .gate.calm * { animation-duration: .01s !important; animation-delay: 0s !important; transition-duration: .01s !important; }
.gate.calm.open { animation: gate-out .3s ease-in forwards !important; }
@keyframes gate-in { from { opacity: 0; } }
@keyframes gate-out { to { opacity: 0; visibility: hidden; } }
@keyframes gate-draw { to { stroke-dashoffset: 0; } }
@keyframes gate-fade { to { opacity: 1; } }
@keyframes gate-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes gate-dot { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }
@media (max-width: 720px) { .gate-frame { inset: 10vh 4vw 12vh; } .gate-text { top: calc(10vh + 15% + min(28vmin, 240px) + 4vh); } }
