/*
 * Humm.OS grid — the interactive constellation from hero-prototype/, shown as
 * in Figma: icons only, no labels or console. Driven by js/os-grid.js.
 */

.os-grid {
  --bg: #363e32;
  --ink: #dfe4dd;
  --muted: #b5c0b0;
  --dim: #6c7d64;
  --stroke: rgba(108, 125, 100, .37);
  position: relative;
  width: 100%;   /* edge to edge: the grid runs out to the sides of the dark block at any width */
  height: max(520px, calc(844 * var(--u)));
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.os-grid__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.constellation {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

/* Core node — Humm.OS */
.core {
  --a: 0;      /* activation */
  --hv: 0;     /* hover */
  --kick: 0;   /* flash when a pulse leaves/arrives */
  position: absolute;
  left: 0;
  top: 0;
  width: 130px;
  height: 130px;
  margin: -65px 0 0 -65px;
  z-index: 3;
  opacity: 0;
  transition: opacity 1s ease;
  will-change: transform;
  outline: none;
}
.core.is-in { opacity: 1; }

.core__box {
  position: absolute;
  inset: 0;
  border-radius: 32px;
  background: var(--bg);
  border: 1px solid rgba(108, 125, 100, calc(.37 + .3 * var(--hv)));
  box-shadow:
    -11px -11px 71px 0 rgba(223, 228, 221, .09),
    81px 78px 45px 0 rgba(0, 0, 0, .01),
    46px 44px 38px 0 rgba(0, 0, 0, .04),
    20px 20px 28px 0 rgba(0, 0, 0, .08),
    5px 5px 16px 0 rgba(0, 0, 0, .09),
    0 0 90px 0 rgba(223, 228, 221, calc(.075 * var(--a)));
}

.core__mark {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  gap: 4.4px;
  transform: translate(-50%, -50%);
  filter:
    saturate(calc(1 - .55 * var(--a)))
    brightness(calc(1 + .75 * var(--a)))
    drop-shadow(0 0 calc(9px * var(--a)) rgba(223, 228, 221, calc(.2 * var(--a))));
}
.core__half {
  display: block;
  width: 22.9085px;
  height: 66.5828px;
  transform-origin: 50% 50%;
}
.core__half--l { translate: calc(-2.5px * var(--a)) 0; }
.core__half--r { translate: calc(2.5px * var(--a)) 0; transform: scaleX(-1); }
.core.is-live .core__half { animation: hum 2.4s ease-in-out infinite; }
.core.is-live .core__half--r { animation-delay: -.6s; }
@keyframes hum {
  0%, 100% { scale: 1 1; }
  50% { scale: 1 1.04; }
}

.core__line {
  position: absolute;
  left: 21px;
  top: 127.4px;
  width: 68.8688px;
  height: 1.60469px;
  transform: scaleY(-1);
  opacity: calc(.75 + .25 * var(--kick));
}
.core.is-live .core__line { animation: scan 2.6s cubic-bezier(.45, 0, .25, 1) infinite; }
@keyframes scan {
  0% { translate: -12px 0; opacity: 0; }
  25%, 75% { opacity: 1; }
  100% { translate: 40px 0; opacity: 0; }
}
.core:focus-visible .core__box { outline: 1px solid var(--muted); outline-offset: 5px; }

/* Service nodes */
.node {
  --p: 0;    /* presence: ghost → fully raised */
  --c: 0;    /* content visibility */
  --h: 0;    /* hover */
  --led: 0;  /* status light */
  position: absolute;
  left: 0;
  top: 0;
  width: 78px;
  height: 78px;
  margin: -39px 0 0 -39px;
  z-index: 2;
  will-change: transform;
  outline: none;
}
.node.is-active { z-index: 4; }

.node__box {
  position: absolute;
  inset: 0;
  border-radius: 23px;
  background: rgba(54, 62, 50, calc(.3 + .7 * var(--p)));
  border: 1px solid rgba(108, 125, 100, calc(.13 + .24 * var(--p) + .3 * var(--h)));
  box-shadow:
    -11px -11px 71px 0 rgba(223, 228, 221, calc(.09 * var(--p))),
    81px 78px 45px 0 rgba(0, 0, 0, calc(.01 * var(--p))),
    46px 44px 38px 0 rgba(0, 0, 0, calc(.04 * var(--p))),
    20px 20px 28px 0 rgba(0, 0, 0, calc(.08 * var(--p))),
    5px 5px 16px 0 rgba(0, 0, 0, calc(.09 * var(--p))),
    0 0 46px 0 rgba(223, 228, 221, calc(.07 * var(--h)));
  transform: scale(calc(.9 + .1 * var(--p)));
}

.node__led {
  position: absolute;
  right: 9px;
  top: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid rgba(108, 125, 100, calc(.25 + .6 * var(--c)));
}
.node__led::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 50%;
  background: var(--ink);
  opacity: var(--led);
  box-shadow: 0 0 8px rgba(223, 228, 221, .9);
}

.node__icon {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.15;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: calc(var(--c) * .92);
  transform: translateY(calc((1 - var(--c)) * 4px));
}

.node:focus-visible .node__box { outline: 1px solid var(--muted); outline-offset: 4px; }

@media (prefers-reduced-motion: reduce) {
  .core.is-live .core__half,
  .core.is-live .core__line { animation: none; }
}
