/* =========================================================================
   THE SHINE
   Borrowed from the card game: a band of light sweeps across a card, and the
   cards do not all light at once — it travels down the page, row by row, so
   there is always something arriving. On a booth screen that is what pulls an
   eye back; in use it is a quiet way of saying "these are the things you can
   press".

   The sweep is a short part of a long cycle. Most of the time nothing is
   moving on any given card, which is what keeps it from being noise.
   ========================================================================= */

/* Positioning is added by the script, and only to elements that are still
   static. Forcing position:relative here dropped every absolutely-positioned
   control back into the flow — the film panel's close button ended up in the
   bottom-left corner. */
.shine--rel { position: relative; }
.shine::after {
  content: '';
  position: absolute; inset: 0; z-index: 3;
  pointer-events: none; border-radius: inherit;
  overflow: hidden;
  /* the band itself: a narrow diagonal highlight */
  background: linear-gradient(
    74deg,
    transparent 42%,
    rgba(255, 255, 255, 0.10) 47%,
    var(--shine-hot, rgba(255, 255, 255, 0.55)) 50%,
    rgba(255, 255, 255, 0.10) 53%,
    transparent 58%);
  background-size: 260% 100%;
  background-repeat: no-repeat;
  background-position: 170% 0;
  animation: shine-sweep var(--shine-cycle, 7s) linear infinite;
  animation-delay: var(--shine-delay, 0s);
}

/* The sweep takes about a second of a seven-second cycle. Animating the
   background position rather than a transform means no extra layer and no
   clipping worries on a rounded card. */
@keyframes shine-sweep {
  0%   { background-position: 170% 0; }
  13%  { background-position: -70% 0; }
  100% { background-position: -70% 0; }
}

/* off-screen cards do not animate at all — the page is long */
.shine:not(.is-lit)::after { animation-play-state: paused; }

/* a dark card wants a hotter band; a white one a softer, wider one */
.acard--dark, .acard--black, .rcard, .ocard--dark { --shine-hot: rgba(255, 255, 255, 0.7); }
.acard:not(.acard--dark):not(.acard--black) { --shine-hot: rgba(255, 255, 255, 0.85); }

/* buttons get a tighter, quicker band so they read as pressable, not decorative */
.shine--btn::after {
  background: linear-gradient(
    74deg,
    transparent 40%,
    rgba(255, 255, 255, 0.22) 48%,
    rgba(255, 255, 255, 0.62) 50%,
    rgba(255, 255, 255, 0.22) 52%,
    transparent 60%);
  background-size: 240% 100%;
  background-repeat: no-repeat;
  background-position: 170% 0;
  animation-duration: var(--shine-cycle, 5.5s);
}

/* =========================================================================
   BOUNCE
   Every button presses in and springs back, and anything that opens a panel
   gives a small kick first so the panel feels like it came out of the press
   rather than appearing on top of it.
   ========================================================================= */
.btn, .acard, .rcard, .ocard, .gpick__btn, .rail__arrow,
.reelopen__go, .pop__x, .reelopen__close, .clogo-wrap, .herowatch {
  transition:
    transform 0.42s cubic-bezier(0.2, 1.35, 0.35, 1),
    box-shadow 0.28s ease,
    filter 0.2s ease;
}
.btn:active, .gpick__btn:active, .rail__arrow:active,
.reelopen__go:active, .pop__x:active, .reelopen__close:active {
  transform: scale(0.93);
  transition-duration: 0.08s;
}
.acard:active, .rcard:active, .ocard:active, .clogo-wrap:active {
  transform: scale(0.97);
  transition-duration: 0.1s;
}

/* the kick a control gives as it opens something */
@keyframes bounce-pop {
  0%   { transform: scale(0.93); }
  45%  { transform: scale(1.06); }
  70%  { transform: scale(0.985); }
  100% { transform: scale(1); }
}
.is-popping { animation: bounce-pop 0.42s cubic-bezier(0.2, 1.2, 0.3, 1); }

/* ── THE PANEL'S OWN ENTRANCE USED TO BE HERE, AND IS NOT ANY MORE ──
   `panel-in` sprang the card popup and the graph stage in from scale(0.9)
   over 460ms, at the same instant the scrim went to full blur. That is the
   "sudden pop-up" Taufik asked to be rid of on 23 August 2026: the panel
   announced itself, in the middle, with nothing having carried the eye there
   from the card that was pressed.

   The entrance now belongs to public/assets/css/arrive.css, where it is one
   rule shared by all four boxes on the site, and it does not begin until a
   copy of the pressed card has flown to the middle and stopped. Do not put a
   `transform` or an `animation` on a panel here again — arrive.css drives the
   same property, and whichever of the two is read last would silently win. */

@media (prefers-reduced-motion: reduce) {
  .shine::after { animation: none; opacity: 0; }
  .is-popping { animation: none; }
  .btn, .acard, .rcard, .ocard, .gpick__btn, .rail__arrow,
  .reelopen__go, .pop__x, .reelopen__close, .clogo-wrap, .herowatch { transition: none; }
}

/* =========================================================================
   THE SHINE, ON THE HEADLINES
   The cards catch the light; the words above them did not, which left the
   biggest thing on every screen as the only dead thing on it.

   A headline cannot take the card treatment — that is a white band painted
   over a box, and a headline has no box, so it would read as a smear across
   the picture behind it. The light has to run through the LETTERS.

   The obvious way to do that is background-clip:text on the heading itself.
   It does not work here, and the reason is worth writing down: every headline
   on this site carries a blue text-shadow glow, and a text-shadow is painted
   ON TOP of the element's background. Turning the glyph fill transparent to
   let a gradient through just reveals the glow behind the letters — the
   headline goes translucent blue and the film reel shows through it.

   So the band is a second copy of the words, laid exactly over the real ones
   and clipped to its own glyphs. Everywhere except the band it is completely
   transparent, so what you see is the real headline, untouched, with a stripe
   of light crossing it. The copy carries an empty alt text so it stays out of
   the accessibility tree.
   ========================================================================= */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .tshine { position: relative; }
  .tshine--rel { position: relative; }

  .tshine::after {
    content: attr(data-shine) / "";
    position: absolute;
    left: 0; top: 0; right: 0;
    pointer-events: none;
    /* everything about the text is inherited, so the copy wraps and sits
       exactly where the real words do — including the uppercase */
    font: inherit; letter-spacing: inherit; text-transform: inherit;
    text-align: inherit; white-space: inherit; line-height: inherit;
    /* no glow on the copy: the real headline underneath already has one, and
       two of them stacked is a blur */
    text-shadow: none;

    /* THE WIDTH OF THE BAND
       The image is three times the width of the headline, so a stop range of
       n% in the gradient paints 3n% of the word. Five per cent is a glint;
       fourteen, which is where this started, turns the whole word blue as the
       sweep goes past. */
    background-image: linear-gradient(
      74deg,
      transparent 47.4%,
      color-mix(in srgb, var(--tshine-hot, #4aa8ff) 45%, transparent) 49.2%,
      var(--tshine-hot, #4aa8ff) 50%,
      color-mix(in srgb, var(--tshine-hot, #4aa8ff) 45%, transparent) 50.8%,
      transparent 52.6%);
    background-size: 300% 100%;
    background-repeat: no-repeat;
    /* the image only covers the letters while the position is between 100%
       and 0%; outside that there is no background at all, and the animation
       stays strictly inside that range */
    background-position: 100% 0;
    -webkit-background-clip: text;
            background-clip: text;
    -webkit-text-fill-color: transparent;
            color: transparent;

    animation: tshine-sweep var(--tshine-cycle, 8.5s) linear infinite;
    animation-delay: var(--shine-delay, 0s);
  }

  /* the sweep is about a second of eight and a half — the rest of the time
     the copy is invisible, which is the point. 100% parks the band off the
     left of the word, 0% parks it off the right. */
  @keyframes tshine-sweep {
    0%   { background-position: 100% 0; }
    12%  { background-position: 0% 0; }
    100% { background-position: 0% 0; }
  }

  /* off screen it does not animate, and the gate is its own class: the
     headlines already use `is-lit` for the torch that follows the cursor, and
     borrowing it here lit every headline as though it were being hovered */
  .tshine:not(.is-shining)::after { animation-play-state: paused; }

  /* A headline mid-sweep while the torch is cutting a hole in it is two
     effects fighting over the same letters. The torch wins — it is the one
     the person is causing. */
  .tshine.is-lit::after { animation-play-state: paused; background-position: 0 0; }

  /* THE GLINT IS BLUE, EVERYWHERE.
     A white band through white letters is nothing at all — and the biggest
     headline on the site, "YOUR WORLD, UNDERSTOOD BY AI.", is pure white. The
     brand blue shows against white letters AND against the near-black ones on
     the chapter pages, so one value covers both and nobody has to know which
     background a heading is sitting on. */
}

@media (prefers-reduced-motion: reduce) {
  .tshine::after { display: none; }
}

/* ═════════════════════════════════════════════════════════════════════════
   THE TILT
   Taufik, 23 August 2026: "for all the card, when open will have the
   animation and transition style of tcg.pokemon.com/…/pitch-black."

   Their gallery card is three effects stacked. The sweep above is the first
   and this site has had it from the start; the deepening shadow is the
   second and `.acard:hover` already did it. This is the third — and it is
   the one that makes a card read as an object you are holding rather than a
   picture of one.

   Theirs: `perspective: 600px` on the outer, the artwork on a transformer
   with `preserve-3d`, rotated towards the pointer, with a gloss that moves
   with it. Same numbers here.

   ── ONE TRANSFORM, ONE SOURCE OF TRUTH ──

   The lift on hover used to be its own `transform: translateY(-6px)`, and a
   tilt written as a second `transform` would simply have replaced it —
   whichever rule won would have cancelled the other. So the lift is a
   variable now and the two compose in one declaration. Anything else that
   wants to move a card should join this line rather than open a second one.
   ═════════════════════════════════════════════════════════════════════════ */
.rail__item, .packrow > *, .gamegrid > * { perspective: 600px; }

.acard, .mobcard {
  --lift: 0px;
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  transform:
    translateY(var(--lift))
    rotateX(var(--tilt-x))
    rotateY(var(--tilt-y));
  transform-style: preserve-3d;
}
/* ── `will-change` ONLY WHILE ONE IS BEING HELD ──
   It was on every card, which is how it is usually written and is wrong here:
   it promotes each one to a compositing layer of its own for the life of the
   page, and a chapter page carries twenty. The hint is worth giving to the
   ONE card a hand is on and to nothing else. */
.acard.is-tilting, .mobcard.is-tilting { will-change: transform; }
.acard:hover, .acard:focus-visible { --lift: -6px; }

/* WHILE THE POINTER IS ON IT there is no transition, or the card lags behind
   the cursor by the length of the ease and feels like treacle. Coming back to
   flat DOES ease, because that one is a release rather than a follow. */
.acard.is-tilting, .mobcard.is-tilting { transition: box-shadow 0.5s linear; }
.acard:not(.is-tilting), .mobcard:not(.is-tilting) {
  transition:
    transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.1),
    box-shadow 0.5s linear;
}

/* ── THE GLOSS ──
   A soft light that sits where the pointer is, the way a foil card catches a
   lamp. `soft-light` rather than `screen`: on a white card screen washes the
   words out, and the point is the SURFACE catching light, not the card going
   brighter. It rides above the artwork and below nothing — pointer-events
   off, so it cannot eat the press. */
.acard.is-tilting::after,
.mobcard.is-tilting::after {
  /* NOT a new element. `::after` on a card is the sweep's, and the sweep is
     paused while a card is being held — two lights on one object at once
     reads as a glitch, which is the same reason the usher pauses it. */
  background-image:
    radial-gradient(
      circle at var(--gloss-x, 50%) var(--gloss-y, 50%),
      rgba(255, 255, 255, 0.42) 0%,
      rgba(255, 255, 255, 0.12) 28%,
      transparent 62%);
  background-size: 100% 100%;
  background-position: 0 0;
  animation: none;
  opacity: 1;
  mix-blend-mode: soft-light;
}
/* a dark card takes a hotter gloss — soft-light on near-black is almost
   nothing, which is exactly where the effect is most worth having */
.acard--dark.is-tilting::after,
.acard--black.is-tilting::after { mix-blend-mode: overlay; }

/* and the shadow moves out under it, which is what sells the lean */
.acard.is-tilting, .mobcard.is-tilting {
  box-shadow: 0 30px 56px -24px rgba(0, 0, 0, 0.5);
}

@media (prefers-reduced-motion: reduce) {
  .acard, .mobcard { transform: none !important; transition: none; }
  .acard.is-tilting::after, .mobcard.is-tilting::after { display: none; }
}

/* the same lean, on the cards that are not `.acard`: the arcade games, the
   milestones, the chapter openers and the film reel. They each have their own
   look and only the transform is shared. */
.gcard, .mcard, .ocard, .rcard {
  --lift: 0px; --tilt-x: 0deg; --tilt-y: 0deg;
  transform: translateY(var(--lift)) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
}
.gcard.is-tilting, .mcard.is-tilting, .ocard.is-tilting, .rcard.is-tilting {
  transition: box-shadow 0.5s linear;
}
.gcard:not(.is-tilting), .mcard:not(.is-tilting),
.ocard:not(.is-tilting), .rcard:not(.is-tilting) {
  transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.1), box-shadow 0.5s linear;
}
/* their parents need the perspective, or the lean is an orthographic squash */
.gamegrid > *, .mtl__item, .ocard, .reel__item { perspective: 600px; }
@media (prefers-reduced-motion: reduce) {
  .gcard, .mcard, .ocard, .rcard { transform: none !important; }
}

/* ═════════════════════════════════════════════════════════════════════════
   THE TURN
   Taufik, 23 August 2026: "its floating, fliping, 360 turn, just like a real
   card. for the back you can just put NEUON AI logo. make it smooth, not
   instant."

   Press a card: it lifts off the page, turns a full circle with its back
   passing the eye halfway round, and settles. 900ms — long enough to read as
   a card being turned over in a hand, short enough that nobody is waiting.

   ── LINEAR, AND SHAPED BY THE KEYFRAMES ──

   The turn and the back's appearance are two animations that must agree on
   when the card is side-on. Under an eased curve "half the time" is not "half
   the rotation", and the logo would appear while the front still faced you.
   Both run linear; the float is shaped by the stops below rather than by the
   easing, so 25% through is 90 degrees in both, by construction.
   ═════════════════════════════════════════════════════════════════════════ */
@keyframes card-turn {
  0%   { transform: translateY(0)     scale(1)    rotateY(0deg); }
  12%  { transform: translateY(-14px) scale(1.03) rotateY(43deg); }
  50%  { transform: translateY(-26px) scale(1.06) rotateY(180deg); }
  88%  { transform: translateY(-14px) scale(1.03) rotateY(317deg); }
  100% { transform: translateY(0)     scale(1)    rotateY(360deg); }
}
/* the back is opaque and only there while the card is turned away: from about
   90 degrees to about 270, which under a linear turn is a quarter to three
   quarters of the way through */
@keyframes card-turn-back {
  0%, 24%   { opacity: 0; }
  26%, 74%  { opacity: 1; }
  76%, 100% { opacity: 0; }
}

.acard.is-turning, .mobcard.is-turning,
.gcard.is-turning, .ocard.is-turning {
  animation: card-turn 900ms linear;
  /* over its neighbours while it is in the air, or the two beside it clip
     the corners off it at the widest part of the turn */
  z-index: 8;
  /* the hover lift and the pointer lean are both `transform`, and an
     animation on the same property outranks them for its duration — which is
     what should happen: a card being turned is not also being leaned. */
}

/* ═════════════════════════════════════════════════════════════════════════
   THE BACK OF A NEUON CARD — ONE PAINT, EVERYWHERE

   Taufik, 23 August 2026, with a picture of eight of them: "make all the card
   back as this blue with NEUON AI logo. especially when fliping."

   There were three backs and they did not match. The card turning in place
   went from #0b63ff to a near-black #0a2a6b, with a six-pixel white ring
   round it. The copy that flies to the middle had its own version of the same
   idea. The foil pack had a third. Turn one card, then another, and they were
   not the same object.

   So the paint is written ONCE, here, and the three selectors below wear it.
   shine.css is on all nine pages; arrive.css is on the two that open a box
   and is read after this, so it must not set a background of its own, and
   site.css is read before this, so it must not either. Both now say so where
   the rules used to be.

   Three layers, bottom up:
     the body     a blue that stays blue all the way down. The old one went
                  almost black at the bottom, which is what made a turning
                  card read as going dark rather than as showing its back.
     the gather   light collecting off the top-left corner, as though the card
                  were catching a window.
     the sheen    one soft diagonal band. It is the same idiom as the shine on
                  the cards' fronts, and it is what makes the back look like a
                  printed card rather than a blue rectangle.
   ═════════════════════════════════════════════════════════════════════════ */
.cardback,
.arrive__face--back,
.ppack__back {
  background:
    linear-gradient(115deg,
      rgba(255, 255, 255, 0) 22%,
      rgba(255, 255, 255, 0.10) 33%,
      rgba(255, 255, 255, 0.26) 42%,
      rgba(255, 255, 255, 0.09) 52%,
      rgba(255, 255, 255, 0) 64%),
    radial-gradient(130% 85% at 26% -6%,
      rgba(150, 205, 255, 0.55) 0%, rgba(150, 205, 255, 0) 60%),
    linear-gradient(162deg, #3c93ff 0%, #1d72f0 38%, #0f56d8 72%, #0b46be 100%);
  /* A hairline rim, not the six-pixel white frame that used to be here — at
     six pixels it read as a border drawn ON a card rather than as the edge of
     one, and on a small card it ate a tenth of the face.

     `outline`, NOT an inset `box-shadow`, which is what it was. The face that
     flies carries an outer box-shadow of its own in arrive.css, and
     box-shadow does not add up across rules: whichever was read last would
     take the whole property, so the flying back would have had a rim and no
     shadow, or a shadow and no rim, depending on the order two files happened
     to be linked in. An outline cannot collide with either. */
  outline: 1px solid rgba(255, 255, 255, 0.24);
  outline-offset: -1px;
}

/* the logo, at the size it sits at in the artwork: about a third of the face,
   centred, with room round it. It was at 46% and filled the card. */
.cardback img,
.arrive__face--back img {
  width: 34%; max-width: 6.6rem; height: auto; display: block;
  opacity: 0.97;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.4));
}

/* ── AND THE ONE THAT TURNS IN PLACE ──
   Counter-mirrored, because the card itself is mirrored at the moment this is
   visible — see the note at the top of public/assets/js/flip.js for why this
   is an overlay rather than an honest back face. The copy that FLIES has two
   real faces and needs none of this; see public/assets/css/arrive.css. */
.cardback {
  position: absolute; inset: 0; z-index: 9;
  border-radius: inherit;
  display: grid; place-items: center;
  opacity: 0; pointer-events: none;
  transform: scaleX(-1);
}
.is-turning > .cardback { animation: card-turn-back 900ms linear; }

@media (prefers-reduced-motion: reduce) {
  .acard.is-turning, .mobcard.is-turning,
  .gcard.is-turning, .ocard.is-turning { animation: none; }
  .cardback { display: none; }
}
