/*
 * Shared copper plasma behind HTML button labels. The oversized gradient is
 * painted once, then only its transform moves; there is no per-button canvas,
 * timer, animated blur, or background-position repaint. Load this file on its
 * own when a page should keep its existing button dimensions and typography.
 *
 * Deliberately exclude page hotspots, the 3D menu faces, and controls which
 * already own a plasma canvas/layer. data-no-copper-plasma is an explicit opt-out.
 */

/* Zero specificity preserves fixed/absolute positioning from each experience. */
:where(
  button, [role="button"], summary, [data-copper-continue] a, #front-entry-music,
  #front-ltuae, a.home-reading-room[href="/ltuae/"],
  a:is(.back-menu,.portal-home,.enter,.btn,.button,.classic-menu-link,.file-button),
  label.file-button,
  [id="demo-start"] a,
  :is(.site-return-nav,.dialog-return-nav,.portal-menu,.bubble-actions,.octa-controls,.vr-controls,.idle-controls,.copper-controls,.controls,.menu-audio) a
):not(:where(
  #host-toggle,.host-sensor,#koala-trigger,.hotspot,[data-hotspot],
  .printed-link,.page *, .octa-face,.sphere-button-slice,
  .enter-button,.home-reading-room:not([href="/ltuae/"]),#front-reading-room,
  [data-no-copper-plasma],:has(> canvas[data-copper-plasma])
)) {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

/* This control was explicitly static; relative keeps its existing flex layout. */
body.intro-demo .site-return-nav #fullscreen { position: relative; }

html body :is(
  button, [role="button"], summary, [data-copper-continue] a, #front-entry-music,
  #front-ltuae, a.home-reading-room[href="/ltuae/"],
  a:is(.back-menu,.portal-home,.enter,.btn,.button,.classic-menu-link,.file-button),
  label.file-button,
  [id="demo-start"] a,
  :is(.site-return-nav,.dialog-return-nav,.portal-menu,.bubble-actions,.octa-controls,.vr-controls,.idle-controls,.copper-controls,.controls,.menu-audio) a
):not(:where(
  #host-toggle,.host-sensor,#koala-trigger,.hotspot,[data-hotspot],
  .printed-link,.page *, .octa-face,.sphere-button-slice,
  .enter-button,.home-reading-room:not([href="/ltuae/"]),#front-reading-room,
  [data-no-copper-plasma],:has(> canvas[data-copper-plasma])
)) {
  background-color: #180e0c !important;
  background-image: linear-gradient(180deg,#392219,#160e0d 76%,#100d10) !important;
  background-size: auto !important;
  border-color: var(--copper-button-border,#b77d55) !important;
  color: #fff0da !important;
  box-shadow: var(--copper-button-shadow,inset 0 1px #ffe0b829,inset 0 0 0 1px #43271a44,0 3px 10px #0005) !important;
  text-shadow: 0 1px 2px #120705,0 0 8px #0c060480 !important;
  transition: border-color .2s ease,box-shadow .2s ease;
}

html body :is(
  button, [role="button"], summary, [data-copper-continue] a, #front-entry-music,
  #front-ltuae, a.home-reading-room[href="/ltuae/"],
  a:is(.back-menu,.portal-home,.enter,.btn,.button,.classic-menu-link,.file-button),
  label.file-button,
  [id="demo-start"] a,
  :is(.site-return-nav,.dialog-return-nav,.portal-menu,.bubble-actions,.octa-controls,.vr-controls,.idle-controls,.copper-controls,.controls,.menu-audio) a
):not(:where(
  #host-toggle,.host-sensor,#koala-trigger,.hotspot,[data-hotspot],
  .printed-link,.page *, .octa-face,.sphere-button-slice,
  .enter-button,.home-reading-room:not([href="/ltuae/"]),#front-reading-room,
  [data-no-copper-plasma],:has(> canvas[data-copper-plasma])
))::before {
  content: "";
  position: absolute;
  inset: -90% -32%;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(#160b0b66,#160b0b66),
    radial-gradient(ellipse at 24% 18%,#ffd7a338,transparent 42%),
    radial-gradient(ellipse at 84% 78%,#d5844855,transparent 46%),
    repeating-radial-gradient(ellipse at 74% -22%,transparent 4%,#1e0c08ad 12%,transparent 24%),
    repeating-radial-gradient(ellipse at 12% 112%,#1e0c08 3%,#592313 11%,#a44d27 17%,#d58448 21%,#592313 29%,#1e0c08 38%);
  opacity: var(--copper-button-glow,.58);
  transform: translate3d(-3%,3%,0) rotate(-6deg) scale(1.05);
  animation: var(--copper-button-flow,copper-button-plasma 16s ease-in-out infinite alternate);
  animation-delay: var(--copper-button-delay,-3s);
  transition: opacity .3s ease;
}

@keyframes copper-button-plasma {
  from { transform: translate3d(-3%,3%,0) rotate(-6deg) scale(1.05); }
  to { transform: translate3d(4%,-4%,0) rotate(7deg) scale(1.13); }
}

/* Only these custom properties are inherited by the decorative plasma layer. */
html body :is(button,a,label.file-button,[role="button"],summary,#front-entry-music,input):nth-of-type(even) { --copper-button-delay: -10s; }
html body :is(button,a,label.file-button,[role="button"],summary,#front-entry-music,input):is([aria-pressed="true"],[aria-selected="true"],.active,.selected) {
  --copper-button-glow: .7;
  --copper-button-border: #ffe0ac;
  --copper-button-shadow: inset 0 0 0 1px #ffc88380,inset 0 1px #ffe0b849,0 0 14px #c8793f30;
}
html body :is(button,a,label.file-button,[role="button"],summary,#front-entry-music,input):not(:disabled):not([aria-disabled="true"]):is(:hover,:focus-visible) {
  --copper-button-glow: .77;
  --copper-button-border: #edbd8d;
  --copper-button-shadow: inset 0 1px #ffe0b849,inset 0 0 0 1px #df9a5a22,0 0 18px #c8793f38,0 4px 12px #0006;
}
html body :is(button,a,label.file-button,[role="button"],summary,#front-entry-music,input):not(:disabled):not([aria-disabled="true"]):active {
  --copper-button-glow: .42;
  --copper-button-shadow: inset 0 2px 7px #080504b3,0 0 10px #c8793f26;
}
html body :is(button,a,label.file-button,[role="button"],summary,#front-entry-music,input):is(:disabled,[aria-disabled="true"]) {
  --copper-button-flow: none;
  --copper-button-glow: .22;
}

/* Replace the older navigation background repaint with the cached layer above. */
html body :is(.site-return-nav,.dialog-return-nav,.bubble-actions,.octa-controls,.vr-controls,.idle-controls,.copper-controls,.controls,.menu-audio) :is(a,button) {
  animation-name: none !important;
}

@media (prefers-reduced-motion: reduce) {
  html body :is(button,a,label.file-button,[role="button"],summary,#front-entry-music,input) {
    --copper-button-flow: none;
    transition: none !important;
  }
  html body :is(button,a,label.file-button,[role="button"],summary,#front-entry-music,input)::before { transition: none; }
}

@media (forced-colors: active) {
  html body :is(button,a,label.file-button,[role="button"],summary,#front-entry-music,input) {
    --copper-button-flow: none;
    --copper-button-glow: 0;
  }
}

/* Form input buttons draw their plasma directly on the control. */
input:is([type="button"],[type="submit"],[type="reset"]) {
  color: #fff0da;
  border-color: #b77d55;
  text-shadow: 0 1px 2px #120705;
  background: repeating-radial-gradient(ellipse at 15% 115%, #271310 5%, #793a21 21%, #422016 30%, #271310 43%);
  background-size: 175% 175%;
  animation: copper-input-flow 16s ease-in-out infinite alternate;
}
@keyframes copper-input-flow { to { background-position: 100% 60%; } }
@media (prefers-reduced-motion: reduce), (forced-colors: active) {
  input:is([type="button"],[type="submit"],[type="reset"]) { animation: none; }
}
