/* =========================================================================
   HOMEPAGE HERO: INTERACTIVE SERVICE STACK  (class prefix: hx-)
   Four isometric slabs, one per offering, drawn as SVG and moved with
   transform/opacity only. Markup: index.html (hero, right column).
   Script: assets/js/hero-stack.js. Loaded on the homepage only.

   Geometry: every slab SVG shares one 600 x 516 viewBox, so 1 viewBox
   unit = var(--u) = 1/600 of the frame width (container query units).
   Slab i rests at centre y = 186 + 60i; the stack spans x = 170 to 600,
   and the frame is cropped to that span (the strip left of x = 170 is
   empty), so the stack fills .hx edge to edge.
   States (set by the script on .hx__layer, and on .hx__item for the
   phone buttons):
     .is-above   slabs above the selected one lift away and open the stack
     .is-active  the selected slab rises slightly and lights up
     .is-below   slabs under it settle a little lower
   ========================================================================= */

.hx {
  --hx-ease: cubic-bezier(0.22, 0.9, 0.24, 1);
  --hx-move: 1000ms;
  --hx-above: -66;            /* lift of slabs above the selected one */
  --hx-active: -14;           /* lift of the selected slab */
  --hx-below: 12;             /* drop of slabs under it */
  --hx-cyan: #8eeaff;
  --hx-sky: #6cc4ff;

  position: relative;
  width: 100%;
  max-width: 410px;
  margin: 0 auto 44px;
  overflow-x: clip;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

/* A little more air above and below the homepage hero on desktop. This
   file loads on the homepage only, so the shared .hero-section rule in
   customstyle.css (also used by tribute.html) is left alone. */
@media (min-width: 992px) {
  .hero-section {
    padding: 132px 0 32px;
  }
}

/* Phones: clear the fixed navbar (about 92px) with room to spare */
@media (max-width: 767.98px) {
  .hero-section {
    padding-top: 132px;
  }
}

/* ---------------------------------------------------------------- frame */
.hx__frame {
  --u: calc(100cqw / 600);
  container-type: inline-size;
  display: grid;
  position: relative;
  width: calc(100% * 600 / 430);
  margin-left: calc(-100% * 170 / 430);
}

.hx.is-ready:not(.is-static) .hx__frame {
  animation: hx-float 8s ease-in-out infinite;
}

.hx__stage {
  grid-area: 1 / 1;
  position: relative;
  aspect-ratio: 600 / 516;
}

/* Faint dot field and a blue bloom behind the stack */
.hx__stage::before,
.hx__stage::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.hx__stage::before {
  inset: 2% 0 0 18%;
  background-image: radial-gradient(rgba(126, 168, 255, 0.2) 1px, transparent 1.5px);
  background-size: 18px 18px;
  -webkit-mask-image: radial-gradient(52% 50% at 56% 52%, #000 0%, transparent 100%);
  mask-image: radial-gradient(52% 50% at 56% 52%, #000 0%, transparent 100%);
}

.hx__stage::after {
  inset: 0;
  background: radial-gradient(42% 40% at 63% 56%, rgba(32, 104, 255, 0.3) 0%, rgba(32, 104, 255, 0.08) 55%, transparent 75%);
}

.hx__defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ---------------------------------------------------------------- slabs */
.hx__layer {
  --dy: 0;
  position: absolute;
  inset: 0;
  z-index: calc(10 - var(--i));
  pointer-events: none;
  transform: translate3d(0, calc(var(--dy) * var(--u)), 0);
  transition: transform var(--hx-move) var(--hx-ease) var(--delay, 0ms);
  will-change: transform;
}

.hx__layer.is-above,
.hx__tipwrap.is-above { --dy: var(--hx-above); }
.hx__layer.is-active,
.hx__tipwrap.is-active { --dy: var(--hx-active); }
.hx__layer.is-below,
.hx__tipwrap.is-below { --dy: var(--hx-below); }

.hx__slab {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  transform-origin: 63% var(--oy);
  transition: transform var(--hx-move) var(--hx-ease) var(--delay, 0ms);
}

.hx__layer.is-active .hx__slab {
  transform: scale(1.02);
}

.hx__shadow {
  fill: rgba(0, 3, 18, 0.75);
  filter: url(#hxBlur);
}

.hx__face--top { fill: url(#hxTop); fill-opacity: 0.94; }
.hx__face--l { fill: url(#hxSideL); }
.hx__face--r { fill: url(#hxSideR); }

.hx__rim,
.hx__edge,
.hx__base,
.hx__inset,
.hx__lit-glow,
.hx__lit-rim,
.hx__lit-edge,
.hx__lit-base,
.hx__focus {
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.hx__rim { stroke: rgba(112, 160, 255, 0.3); stroke-width: 1; }
.hx__edge { stroke: rgba(126, 178, 255, 0.5); stroke-width: 1; }
.hx__base { stroke: rgba(92, 140, 230, 0.22); stroke-width: 1; }
.hx__inset { stroke: rgba(255, 255, 255, 0.07); stroke-width: 1; }

/* The lit treatment fades in over the subdued one */
.hx__lit {
  opacity: 0;
  transition: opacity 700ms ease var(--delay, 0ms);
}

.hx__layer.is-active .hx__lit {
  opacity: 1;
}

.hx__lit-l { fill: url(#hxSideLLit); }
.hx__lit-r { fill: url(#hxSideRLit); }
.hx__lit-top { fill: url(#hxTopLit); fill-opacity: 0.96; }
.hx__lit-sheen { fill: url(#hxSheen); }
.hx__lit-glow { stroke: #4fb3ff; stroke-width: 7; opacity: 0.75; filter: url(#hxGlow); }
.hx__lit-rim { stroke: rgba(196, 232, 255, 0.75); stroke-width: 1.25; }
.hx__lit-edge { stroke: url(#hxEdge); stroke-width: 1.75; }
.hx__lit-base { stroke: rgba(142, 234, 255, 0.45); stroke-width: 1; }

/* Category name printed on the top face (the SVG transform puts it in the
   face plane, along the front-left edge, so it travels with its slab) */
.hx__tag,
.hx__tag-glow {
  font-family: var(--title-font);
  font-size: 15px;            /* viewBox units: scales with the stack */
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  pointer-events: none;
}

.hx__tag {
  fill: rgba(160, 188, 235, 0.62);
  transition: fill 500ms ease var(--delay, 0ms);
}

.hx__tag-glow {
  fill: #4fb3ff;
  opacity: 0.85;
  filter: url(#hxGlow);
}

.hx__layer.is-active .hx__tag {
  fill: #ffffff;
}

/* Pointer over a slab: lift its outline and name right away (selection
   follows after a short hover intent) */
.hx__rim,
.hx__edge {
  transition: stroke 300ms ease;
}

.hx__layer:has(.hx__hit:hover) .hx__rim { stroke: rgba(150, 196, 255, 0.6); }
.hx__layer:has(.hx__hit:hover) .hx__edge { stroke: rgba(150, 210, 255, 0.85); }
.hx__layer:has(.hx__hit:hover):not(.is-active) .hx__tag { fill: rgba(214, 230, 255, 0.85); }

/* Keyboard focus on a slab's (hidden) link: outline the slab itself */
.hx__focus {
  stroke: #ffffff;
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
  opacity: 0;
  transform: scale(1.05);       /* sits just outside the slab and its glow */
  transform-box: fill-box;
  transform-origin: center;
}

.hx__layer.has-focus .hx__focus {
  opacity: 1;
}

/* Pointer target: the slab's visible outline */
.hx__hit {
  fill: none;
  pointer-events: fill;
  cursor: pointer;
}

/* ---------------------------------------------------------------- steps
   Line indicator in the stage's empty bottom-right corner (under the
   right side of the AI slab). Shares the stage's grid cell, so on phones
   it stays on the stage, above the touch buttons. Each 24px line sits in
   a 30 x 24px hit area. The active line fills over the layer's turn and
   freezes while cycling is paused (same pause as the script's timer). */
.hx__steps {
  grid-area: 1 / 1;
  align-self: end;
  justify-self: end;
  z-index: 25;
  display: flex;
  align-items: center;
  margin: 0 calc(14 * var(--u) - 3px) calc(6 * var(--u)) 0;
}

.hx__step {
  display: grid;
  place-items: center;
  width: 30px;
  height: 24px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.hx__step > span {
  position: relative;
  width: 24px;
  height: 2px;
  overflow: hidden;
  border-radius: 2px;
  background-color: rgba(150, 178, 225, 0.25);
  transition: background-color 300ms ease;
}

.hx__step:hover > span {
  background-color: rgba(170, 200, 245, 0.5);
}

/* the blue fill */
.hx__step > span::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #1f6fd6, #3d9bff);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 400ms var(--hx-ease);
}

.hx__step.is-active > span::after {
  transform: scaleX(1);
}

.hx.is-ready:not(.is-static) .hx__step.is-active > span::after {
  animation: hx-step-fill var(--hx-dwell, 3800ms) linear both;
}

/* as specific as the rule above, so the pause wins over its shorthand */
.hx.is-ready.is-paused:not(.is-static) .hx__step.is-active > span::after {
  animation-play-state: paused;
}

@keyframes hx-step-fill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* ---------------------------------------------------------------- links
   The four service links are the keyboard and screen-reader controls. The
   names are printed on the slabs, so from 576px up the links are hidden
   visually (still focusable; focus outlines the slab, see .hx__focus).
   On phones they become a row of touch targets under the stack. */
.hx__labels {
  grid-area: 2 / 1;
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.hx__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.hx__label {
  text-decoration: none;
}

/* ---------------------------------------------------------------- tooltip
   One tooltip per layer, in an overlay above every slab. Each sits in a
   full-stage wrapper that takes its slab's state class, so it rises and
   settles with the slab (same --dy, same easing and delay).

   Each layer has its own spot (viewBox units, measured with the layer
   selected), chosen so no tooltip covers a printed name:
     BUILD      upper right, right-aligned to the stack     top 44
     TEAM       middle, just right of the TEAM name          top 196, x 324
                (the names fill the left half, so there is no clear spot
                further left at this height)
     MODERNIZE  lower right, right-aligned                   top 354
     AI         lower left, left-aligned, under the AI name  top 414
   The "top" values below add the desktop lift (14) back, so each tooltip
   keeps the same distance from its own slab and name at every size.
   Width is capped in viewBox units too, so on narrow phones the tooltip
   shrinks with the stack and never leaves it. On phones the lower two
   move to the bottom right (see the phone section).
   Shown only while someone is interacting (.show-tip, set by the script);
   clicking it opens the service, like the slab. */
.hx__tips {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}

.hx__tipwrap {
  --dy: 0;
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform: translate3d(0, calc(var(--dy) * var(--u)), 0);
  transition: transform var(--hx-move) var(--hx-ease) var(--delay, 0ms);
}

.hx__tip {
  --sx: 0px;                  /* where it slides in from, per layer */
  --sy: 6px;
  position: absolute;
  width: min(220px, calc(250 * var(--u)));
  padding: 12px 14px 13px;
  border: 1px solid rgba(108, 196, 255, 0.28);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(20, 44, 92, 0.94), rgba(7, 16, 38, 0.96));
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  text-align: left;
  cursor: pointer;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translate3d(var(--sx), var(--sy), 0);
  transition: opacity 200ms ease, transform 300ms var(--hx-ease), visibility 0s linear 200ms;
}

/* Per-layer placement; each slides in from the side nearest its slab */
.hx__tip--build {
  top: calc((44 + 14) * var(--u));
  right: calc(4 * var(--u));
  --sx: -8px;
  --sy: 8px;
}

.hx__tip--team {
  top: calc((196 + 14) * var(--u));
  left: calc(324 * var(--u));
  --sx: -10px;
  --sy: 0px;
}

.hx__tip--modernize {
  top: calc((354 + 14) * var(--u));
  right: calc(4 * var(--u));
  --sx: -8px;
  --sy: -8px;
}

.hx__tip--ai {
  top: calc((414 + 14) * var(--u));
  left: calc(172 * var(--u));
  --sx: 8px;
  --sy: -8px;
}

.hx.show-tip .hx__tipwrap.is-active .hx__tip {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
  transition: opacity 260ms ease 80ms, transform 360ms var(--hx-ease) 80ms, visibility 0s;
}

.hx__tip-title {
  display: block;
  font-family: var(--title-font);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
  color: #ffffff;
}

.hx__tip-title .material-icons-round {
  display: inline-block;
  margin-left: 4px;
  vertical-align: -3px;
  font-size: 15px;
  color: var(--hx-sky);
  transition: transform 300ms var(--hx-ease);
}

.hx__tip:hover .hx__tip-title .material-icons-round {
  transform: translate(2px, -2px);
}

.hx__tip-desc {
  display: block;
  margin-top: 4px;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.7);
}

/* ---------------------------------------------------------------- motion */
@keyframes hx-float {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -6px, 0); }
}

/* Reduced motion: no cycling, no float, states change without travel */
@media (prefers-reduced-motion: reduce) {
  .hx {
    --hx-move: 0ms;
  }

  .hx__lit,
  .hx__tip,
  .hx.show-tip .hx__tipwrap.is-active .hx__tip {
    transition-duration: 0ms;
    transition-delay: 0ms;
  }
}

/* ---------------------------------------------------------------- tablet */
@media (max-width: 991.98px) {
  .hx {
    max-width: 440px;
    margin-top: 8px;
    margin-bottom: 56px;
  }
}

/* ---------------------------------------------------------------- phone
   The stack fills the width, movement is gentler, and the four services
   become a row of touch targets. */
@media (max-width: 575.98px) {
  .hx {
    --hx-above: -44;
    --hx-active: -10;
    --hx-below: 8;
    margin-top: 0;
    margin-bottom: 48px;
  }

  .hx.is-ready:not(.is-static) .hx__frame {
    animation: none;
  }

  .hx__layer.is-active .hx__slab {
    transform: none;
  }

  .hx__labels {
    position: static;
    width: calc(430 * var(--u));
    height: auto;
    margin-left: calc(170 * var(--u));
    margin-top: 4px;
    overflow: visible;
    clip-path: none;
    white-space: normal;
  }

  .hx__list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .hx__item {
    display: flex;
  }

  .hx__label {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 52px;
    padding: 8px 2px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-family: var(--title-font);
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.42);
    transition: color 300ms ease, border-color 300ms ease, background-color 300ms ease;
  }

  .hx__num {
    font-weight: 500;
    letter-spacing: 0.04em;
    color: rgba(140, 180, 255, 0.5);
    transition: color 300ms ease;
  }

  .hx__label:focus-visible {
    outline: 2px solid var(--hx-sky);
    outline-offset: 2px;
  }

  .hx__item.is-active .hx__label {
    color: #ffffff;
  }

  .hx__item.is-active .hx__num {
    color: var(--hx-sky);
  }

  .hx__item.is-active .hx__label {
    border-color: rgba(108, 196, 255, 0.55);
    background-color: rgba(40, 110, 255, 0.14);
  }

  .hx__tip {
    padding: 10px 12px 11px;
  }

  /* The phone stack is too short for the lower tooltips to hang under
     their slabs without reaching the buttons below, so they rise from the
     bottom-right corner instead, clear of every printed name. */
  /* narrow phones wrap TEAM's text taller: lift it clear of MODERNIZE
     (everything right of x = 324 is free of names) */
  .hx__tip--team {
    top: calc((150 + 10) * var(--u));
  }

  .hx__tip--modernize,
  .hx__tip--ai {
    top: auto;
    right: calc(4 * var(--u));
    bottom: calc(-6 * var(--u));
    left: auto;
    --sx: 0px;
    --sy: 8px;
  }

  .hx__tip-desc {
    font-size: 0.78rem;
  }
}
