/* DSO Headquarters — signature effects layer (loaded after hq.css) */

/* Live light field canvas behind everything */
#field { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; }

/* Cursor spotlight + border flare on panels (JS sets --mx/--my) */
.panel.fx::before {
  background:
    radial-gradient(240px circle at var(--mx, 50%) var(--my, -60%), rgba(255, 255, 255, 0.9), transparent 62%),
    var(--edge);
}
.panel.fx > .spot {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(460px circle at var(--mx, 50%) var(--my, -60%), rgba(90, 202, 248, 0.11), transparent 62%);
  opacity: 0; transition: opacity var(--med) var(--ease);
}
.panel.fx:hover > .spot { opacity: 1; }
.tilt { transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform 600ms var(--ease); }
.tilt.tilting { transition: transform 90ms linear; }

/* Live ops ticker under the command bar */
.ticker {
  position: sticky; top: 64px; z-index: 30;
  display: flex; align-items: center;
  height: 30px; overflow: hidden;
  background: rgba(3, 4, 10, 0.8);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  font: 11px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.ticker .tag { flex: none; position: relative; z-index: 1; height: 100%; display: flex; align-items: center; gap: 8px; padding: 0 22px 0 var(--gutter); color: var(--green); background: linear-gradient(90deg, #03040a 75%, transparent); }
.ticker .track { display: flex; gap: 56px; white-space: nowrap; animation: tick 60s linear infinite; padding-left: 10px; mask-image: linear-gradient(90deg, transparent 0, #000 40px); }
.ticker .tag { margin-right: 6px; z-index: 2; }
.ticker .track { position: relative; z-index: 0; }
.ticker:hover .track { animation-play-state: paused; }
.ticker .item b { color: var(--text); font-weight: 600; }
.ticker .item .c { color: var(--cyan); }
.ticker .item .r { color: var(--red-glow); }
.ticker .item .g { color: var(--green); }
@keyframes tick { to { transform: translateX(-50%); } }

/* Command palette (Ctrl/Cmd + K) */
.kbd { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 5px; font: 600 10px/1 var(--mono); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-strong); background: rgba(220, 203, 208, 0.05); }
.palette-trigger { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px 0 12px; border: 0; color: var(--muted); background: rgba(220, 203, 208, 0.05); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; font: 12px var(--ui); clip-path: polygon(6px 0, 100% 0, 100% 100%, 0 100%, 0 6px); }
.palette-trigger:hover { color: #fff; box-shadow: inset 0 0 0 1px var(--cyan); }
dialog.palette { width: min(640px, calc(100vw - 32px)); max-height: none; margin: 12vh auto auto; padding: 0; border: 0; color: var(--text); background: transparent; overflow: visible; }
dialog.palette::backdrop { background: rgba(3, 4, 10, 0.62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
dialog.palette[open] .panel { animation: pal-in 260ms var(--ease) both; }
@keyframes pal-in { from { opacity: 0; transform: translateY(-10px) scale(0.98); } }
.palette .panel { padding: 0; }
.palette .pal-input { position: relative; }
.palette input { min-height: 58px; padding: 0 20px 0 50px; font-size: 17px; box-shadow: none; background: transparent; border-bottom: 1px solid var(--line); }
.palette input:focus { box-shadow: none; background: transparent; }
.palette .search-ico { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); color: var(--cyan); }
.palette ul { list-style: none; margin: 0; padding: 8px; max-height: min(420px, 60vh); overflow-y: auto; }
.palette li a { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; color: var(--text); }
.palette li a .ico { color: var(--cyan); font: 700 14px var(--display); }
.palette li a .k { font: 10px var(--mono); color: var(--dim); letter-spacing: 0.12em; text-transform: uppercase; }
.palette li[aria-selected="true"] a { background: linear-gradient(90deg, rgba(9, 146, 249, 0.24), transparent); box-shadow: inset 2px 0 0 var(--cyan); }
.palette .grp { padding: 10px 12px 4px; font: 600 10px var(--mono); letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); }
.palette .pal-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); font: 10px var(--mono); color: var(--dim); letter-spacing: 0.08em; text-transform: uppercase; }

/* Toasts */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: grid; gap: 10px; width: min(360px, calc(100vw - 36px)); }
.toast { padding: 14px 16px 14px 18px; display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; animation: toast-in 460ms var(--ease) both; }
.toast.out { animation: toast-out 300ms var(--ease) both; }
.toast .t-ico { width: 30px; height: 30px; display: grid; place-items: center; background: linear-gradient(135deg, var(--blue), var(--red-2)); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); font: 700 13px var(--display); }
.toast b { display: block; font: 700 14px/1.2 var(--display); letter-spacing: 0.05em; text-transform: uppercase; }
.toast span { font-size: 13px; color: var(--muted); }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px) scale(0.95); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(40px); } }

/* Boot sequence (first page after sign-in, once per session) */
.boot { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: var(--void); animation: boot-out 520ms 2.2s var(--ease) forwards; }
.boot .core { position: relative; display: grid; justify-items: center; gap: 22px; perspective: 800px; }
.boot img { width: 210px; animation: boot-shield 1.3s var(--ease) both; filter: drop-shadow(0 0 40px rgba(9, 146, 249, 0.45)); }
.boot .lines { font: 11px/1.9 var(--mono); letter-spacing: 0.2em; text-transform: uppercase; color: var(--cyan); text-align: center; min-height: 64px; }
.boot .lines span { display: block; opacity: 0; animation: boot-line 260ms var(--ease) forwards; }
.boot .lines span:nth-child(1) { animation-delay: 0.55s; }
.boot .lines span:nth-child(2) { animation-delay: 0.95s; }
.boot .lines span:nth-child(3) { animation-delay: 1.35s; color: var(--green); }
.boot .beam { position: absolute; left: 50%; top: 38%; width: 140vw; height: 2px; transform: translateX(-50%) scaleX(0); background: linear-gradient(90deg, transparent, var(--blue-2), #fff, var(--red), transparent); box-shadow: 0 0 24px #fff; animation: beam 1s 0.15s var(--ease) both; }
@keyframes boot-shield { from { opacity: 0; transform: scale(0.55) rotateX(70deg); filter: blur(14px) brightness(3); } }
@keyframes boot-line { to { opacity: 1; } }
@keyframes beam { 45% { transform: translateX(-50%) scaleX(1); opacity: 1; } to { transform: translateX(-50%) scaleX(1); opacity: 0; } }
@keyframes boot-out { to { opacity: 0; visibility: hidden; transform: scale(1.05); } }

/* Glitch-split headline: blue and red ghosts slip apart */
.glitch { position: relative; display: inline-block; }
.glitch::before, .glitch::after { content: attr(data-text); position: absolute; inset: 0; pointer-events: none; opacity: 0; -webkit-text-fill-color: currentColor; }
.glitch::before { color: var(--blue-2); }
.glitch::after { color: var(--red); }
.glitch:hover::before, .glitch.live::before { animation: gl-a 800ms steps(2, end) 1; }
.glitch:hover::after, .glitch.live::after { animation: gl-b 800ms steps(2, end) 1; }
@keyframes gl-a { 0%, 100% { opacity: 0; transform: none; } 20% { opacity: 0.85; transform: translate(-5px, 1px); clip-path: inset(10% 0 55% 0); } 50% { opacity: 0.7; transform: translate(4px, -1px); clip-path: inset(60% 0 8% 0); } }
@keyframes gl-b { 0%, 100% { opacity: 0; transform: none; } 25% { opacity: 0.85; transform: translate(5px, -1px); clip-path: inset(50% 0 20% 0); } 60% { opacity: 0.7; transform: translate(-4px, 1px); clip-path: inset(5% 0 70% 0); } }

/* Radial gauge */
.gauge { --p: 0; position: relative; width: 124px; aspect-ratio: 1; display: grid; place-items: center; flex: none; }
.gauge svg { position: absolute; inset: 0; transform: rotate(-90deg); overflow: visible; }
.gauge .trk { fill: none; stroke: rgba(220, 203, 208, 0.08); stroke-width: 8; }
.gauge .val { fill: none; stroke: url(#gaugeGrad); stroke-width: 8; stroke-dasharray: 302; stroke-dashoffset: 302; transition: stroke-dashoffset 1.4s var(--ease); filter: drop-shadow(0 0 6px rgba(90, 202, 248, 0.6)); }
.gauge.on .val { stroke-dashoffset: calc(302 - 302 * var(--p) / 100); }
.gauge .g-in { text-align: center; }
.gauge b { font: 700 30px/1 var(--display); }
.gauge span { display: block; margin-top: 4px; font: 10px var(--mono); color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; }

/* Magnetic buttons */
.magnet { transition: transform 350ms var(--ease), filter var(--fast); }

/* Scroll reveal */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 700ms var(--ease), transform 700ms var(--ease); transition-delay: calc(var(--i, 0) * 50ms); }
.reveal.in { opacity: 1; transform: none; }

/* Activity heat strip (creator activity, 7x24) */
.heat { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; }
.heat i { aspect-ratio: 1; background: rgba(90, 202, 248, calc(var(--v) * 0.9 + 0.04)); clip-path: polygon(25% 0, 100% 0, 75% 100%, 0 100%); }

@media (prefers-reduced-motion: reduce) {
  #field, .boot { display: none; }
  .ticker .track { animation: none; }
  .reveal { opacity: 1; transform: none; }
  .tilt { transform: none !important; }
  .gauge .val { transition: none; }
}
@media (max-width: 900px) {
  .palette-trigger .lbl, .palette-trigger .kbd { display: none; }
}
@media (hover: none) { .tilt { transform: none !important; } }

/* Responsibility list with diamond ticks */
.ticks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ticks li { position: relative; padding-left: 26px; color: var(--text); }
.ticks li::before { content: ""; position: absolute; left: 4px; top: 0.55em; width: 8px; height: 8px; background: var(--split); transform: rotate(45deg); box-shadow: 0 0 10px rgba(90, 202, 248, 0.5); }
