/* ---------------------------------------------------------------------
   Card glow — a soft light that opens from the exact point you touch.
   Mouse: follows the pointer while it is over the card.
   Touch: spreads from the tap point and fades out after the finger lifts.
   Two quiet layers only: a faint wash inside the card and a thin light on
   the border nearest the touch. Nothing is drawn until a card is touched.
   Applies to: .flow-card, .pdf-tool-card, .steps li, .uchip, .logo-tile
   Elements are added by js/card-glow.js (<cg-glow>, <cg-rim>).
   --------------------------------------------------------------------- */
@property --cg-r { syntax: "<length>"; inherits: true; initial-value: 0px; }

.cg-host,
.pdf-tool-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  --cg-wash: rgba(240, 195, 120, .115);   /* inner light, dark theme */
  --cg-wash-2: rgba(240, 195, 120, .04);
  --cg-edge: rgba(240, 195, 120, .55);    /* border light, dark theme */
}
html[data-theme="light"] .cg-host,
html[data-theme="light"] .pdf-tool-card {
  --cg-wash: rgba(201, 154, 59, .15);
  --cg-wash-2: rgba(201, 154, 59, .05);
  --cg-edge: rgba(201, 154, 59, .7);
}

/* how far the light spreads, per card size */
.flow-card      { --cg-size: 260px; }
.steps li       { --cg-size: 240px; }
.pdf-tool-card  { --cg-size: 210px; }
.logo-tile      { --cg-size: 150px; }
.uchip          { --cg-size: 130px; }

.cg-host > cg-glow,
.cg-host > cg-rim {
  display: block;
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  --cg-r: 0px;
  transition: --cg-r .55s cubic-bezier(.4, 0, .6, 1), opacity .45s ease;
}

/* inside light: sits above the card background, below its text (negative z in the card's own stacking context) */
.cg-host > cg-glow {
  z-index: -1;
  background: radial-gradient(circle var(--cg-r) at var(--cg-x, 50%) var(--cg-y, 50%),
    var(--cg-wash) 0%, var(--cg-wash-2) 55%, transparent 100%);
}

/* edge light: a 1px ring that only shows near the touch point */
.cg-host > cg-rim {
  z-index: 0;
  padding: 1px;
  background: radial-gradient(circle calc(var(--cg-r) * .85) at var(--cg-x, 50%) var(--cg-y, 50%),
    var(--cg-edge) 0%, transparent 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
}

/* lit: the light opens out from the touch point (slow and eased) */
.cg-host.cg-lit > cg-glow,
.cg-host.cg-lit > cg-rim {
  opacity: 1;
  --cg-r: var(--cg-size, 240px);
  transition: --cg-r .85s cubic-bezier(.16, .84, .3, 1), opacity .35s ease;
}

@media (prefers-reduced-motion: reduce) {
  .cg-host > cg-glow,
  .cg-host > cg-rim,
  .cg-host.cg-lit > cg-glow,
  .cg-host.cg-lit > cg-rim { transition: opacity .2s linear; }
}
