/* Metic State apex surface.

   Ported from npux.app's public/app.css so the two properties stop feeling
   like different companies. They already shared the type stack and the
   palette; what the apex was missing was the surface.

   Loaded as a link AFTER each page's own <style> block, so it wins on
   cascade order at equal specificity and the pages keep their own layout.
   Nothing here changes a layout. If a rule in here starts fighting a page,
   the rule in here is the one that is wrong.

   Three layers, three jobs, no markup and no assets:

     html::before   the ambient field, drifting
     html::after    the hairline mesh, static
     body::before   the grain, shifting

   They sit at z-index -1, which paints them above the page background and
   below every piece of content. That works because none of the pages give
   <html> a background of its own, so the <body> background propagates to
   the canvas and paints underneath. Give <html> a background and all three
   layers vanish behind it.

   No page used a body or html pseudo-element when this was written. Check
   before adding one.

   NPUX's second ambient radial is #5d9ab5, which is its GPU lane colour and
   not an apex brand colour. Dropped rather than carried over.
*/

/* The tokens this sheet uses, --ease, --ease-io, --glass and --glass-sh,
   live in tokens.css, which loads before it. */

html::before,
html::after,
body::before{
  content:"";
  position:fixed;
  inset:0;
  z-index:-1;
  pointer-events:none;
}

/* The ambient field. Slower and shallower than the app's, because this is a
   page someone reads rather than a screen they watch for ten seconds. */
html::before{
  background-image:
    radial-gradient(130% 70% at 18% -6%, rgba(46,189,58,.085), transparent 58%),
    radial-gradient(150% 80% at 50% 110%, rgba(0,0,0,.34), transparent 60%);
  animation:apexDrift 28s var(--ease-io) infinite alternate;
}
@keyframes apexDrift{to{transform:translate3d(0,-10px,0) scale(1.04)}}

/* The mesh. Static on purpose: drifting it would make the grid breathe,
   and a 28px grid sliding under body copy is a distraction. */
html::after{
  opacity:.5;
  background-image:
    linear-gradient(rgba(237,242,240,.030) 1px,transparent 1px),
    linear-gradient(90deg,rgba(237,242,240,.030) 1px,transparent 1px);
  background-size:28px 28px;
}

/* The grain. Inline feTurbulence, so it costs no request and no file.
   Inset past the viewport so the shift never exposes an edge. */
body::before{
  inset:-40%;
  opacity:.34;
  mix-blend-mode:overlay;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='.42'/%3E%3C/svg%3E");
  animation:apexGrain 1.1s steps(3) infinite;
}
@keyframes apexGrain{
  0%{transform:translate(0,0)}
  33%{transform:translate(-3%,2%)}
  66%{transform:translate(2%,-3%)}
}

/* Glass on the panels.

   backdrop-filter does nothing behind an opaque fill, so the panel colour
   goes translucent and the field and grain come through it. At .62 over
   #232b2d the result sits within a shade of the old flat #283133, so the
   contrast the pages were built against is unchanged.

   .svc already uses both its own pseudo-elements for the circuit mark in
   the corner. Do not reach for ::before or ::after here. */
.svc,
.tile,
.card.panel{
  background:var(--glass), rgba(40,49,51,.62);
  backdrop-filter:blur(16px) saturate(1.35);
  -webkit-backdrop-filter:blur(16px) saturate(1.35);
  box-shadow:var(--glass-sh);
}

/* Figures stop jittering. Prices, dates and anything else numeric sit on
   tabular numerals so a column of them lines up and a hover does not
   reflow the card. */
.price,
.meta,
.stamp,
time,
footer{
  font-variant-numeric:tabular-nums;
  font-feature-settings:"tnum" 1;
}

@media (prefers-reduced-motion:reduce){
  html::before,
  body::before{animation:none}
}
