/* «لمسة الضوء» — one look for every card on the site (v23).
   Glass with a warm light in its corner; a thin ring of gold and lilac that wakes and turns when you come near;
   a soft light that follows your hand inside the card; small cards lean towards you a little.
   The pointer position comes from cards.js (CSS variables --mx/--my/--rx/--ry). Calm with reduced motion. */
@property --lum-a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@property --lum { syntax: "<number>"; inherits: true; initial-value: 0; }

:root :is(.door, .slot, .work, .bts, .fav, .memory, .guide-card, .lab-card, .kw-chapter, .tour) {
  --mx: 30%; --my: 0%;
  position: relative; isolation: isolate;
  background:
    radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, var(--gold) 10%, transparent), transparent 62%),
    radial-gradient(90% 70% at 100% 100%, color-mix(in srgb, var(--lilac) 7%, transparent), transparent 70%),
    linear-gradient(160deg, color-mix(in srgb, var(--veil) 94%, transparent), color-mix(in srgb, var(--night-2) 97%, transparent));
  border-color: color-mix(in srgb, var(--gold) 20%, var(--line));
  box-shadow: inset 0 1px 0 #ffffff10, 0 18px 40px -26px #000;
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(calc(var(--lum) * -4px));
  transition: transform .45s cubic-bezier(.2, .8, .2, 1), box-shadow .45s, border-color .45s, --lum .45s;
}
/* the ring: a turning band of light drawn only on the border */
:root :is(.door, .slot, .work, .bts, .fav, .memory, .guide-card, .lab-card, .kw-chapter, .tour)::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1.2px; z-index: -1; pointer-events: none;
  background: conic-gradient(from var(--lum-a), transparent 0 55%, color-mix(in srgb, var(--gold) 90%, #fff) 68%, var(--lilac) 80%, transparent 92%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: calc(.15 + var(--lum) * .85);
  animation: lum-turn 7s linear infinite; animation-play-state: paused;
}
/* the light that follows the hand, and a faint dust of stars inside it */
:root :is(.door, .slot, .work, .bts, .fav, .memory, .guide-card, .lab-card, .kw-chapter, .tour)::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1; pointer-events: none;
  background:
    radial-gradient(240px circle at var(--mx) var(--my), color-mix(in srgb, var(--gold) 20%, transparent), transparent 62%),
    radial-gradient(1.2px 1.2px at 18% 30%, #fff8 50%, transparent 51%), radial-gradient(1px 1px at 72% 22%, #fff6 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 58% 78%, #fff5 50%, transparent 51%), radial-gradient(1px 1px at 86% 64%, #fff7 50%, transparent 51%);
  opacity: var(--lum);
}
:root :is(.door, .slot, .work, .bts, .fav, .memory, .guide-card, .lab-card, .kw-chapter, .tour):is(:hover, :focus-within, .lum-on) {
  --lum: 1;
  border-color: color-mix(in srgb, var(--gold) 55%, var(--line));
  box-shadow: inset 0 1px 0 #ffffff18, 0 24px 50px -24px #000, 0 0 34px -10px color-mix(in srgb, var(--gold) 45%, transparent);
}
:root :is(.door, .slot, .work, .bts, .fav, .memory, .guide-card, .lab-card, .kw-chapter, .tour):is(:hover, .lum-on)::before { animation-play-state: running; }
/* text cards stay flat (only light, no tilt) so long reading never sways */
:root :is(.slot, .memory, .guide-card, .kw-chapter) { --rx: 0deg !important; --ry: 0deg !important; }
@keyframes lum-turn { to { --lum-a: 360deg; } }

@media (prefers-reduced-motion: reduce) {
  :root :is(.door, .slot, .work, .bts, .fav, .memory, .guide-card, .lab-card, .kw-chapter, .tour) { transform: none !important; transition: border-color .2s, box-shadow .2s; }
  :root :is(.door, .slot, .work, .bts, .fav, .memory, .guide-card, .lab-card, .kw-chapter, .tour)::before { animation: none; background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 70%, transparent), transparent 40%, transparent 60%, color-mix(in srgb, var(--lilac) 60%, transparent)); }
}
@media (hover: none) { /* phones: the light appears where you touch, briefly (cards.js adds .lum-on) */
  :root :is(.door, .slot, .work, .bts, .fav, .memory, .guide-card, .lab-card, .kw-chapter, .tour):hover:not(.lum-on) { --lum: 0; }
}
