/* Website 3D — the styles website_3d.js switches on (html.w3d). The same file is in the extraatom, bizbot and jmtdev
   repos; a site's colours come in as custom properties from its website_3d.py (WEB3D.vars):
     --w3d-depth   colour of a heading's 3D depth     --w3d-soft   its soft drop shadow
     --w3d-glow    colour of the light that follows the mouse on a card
   Nothing here applies until the script runs, so without JavaScript the page is the original. */

/* the hero: the three.js canvas sits between the background art and the content */
.w3d .w3d-hero { position: relative; overflow: hidden; }
.w3d .w3d-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; transition: opacity 1.2s ease; }
.w3d .w3d-lift { z-index: 2 !important; }  /* website_3d.js makes it position: relative if it was static */
@media (max-width: 700px) { .w3d .w3d-canvas { opacity: .7; } }  /* phones: the scene stays behind the text */
.w3d .w3d-parallax { will-change: transform; transform-origin: 50% 40%; }

/* headings with depth: stacked shadows read as an extruded letter, a soft drop under it */
.w3d .w3d-text {
    text-shadow: 0 1px 0 var(--w3d-depth, rgba(0,0,0,.18)), 0 2px 0 var(--w3d-depth, rgba(0,0,0,.16)), 0 3px 0 var(--w3d-depth, rgba(0,0,0,.14)),
                 0 4px 0 var(--w3d-depth, rgba(0,0,0,.12)), 0 6px 8px var(--w3d-soft, rgba(0,0,0,.18)), 0 14px 24px var(--w3d-soft, rgba(0,0,0,.14));
}
/* gradient-filled text (clip: text) can't carry a text-shadow: give it a drop-shadow instead */
.w3d .w3d-text .w3d-clip { text-shadow: none; filter: drop-shadow(0 3px 0 var(--w3d-depth, rgba(0,0,0,.25))) drop-shadow(0 10px 14px rgba(0,0,0,.25)); }

/* cards lean towards the mouse; a light follows it */
.w3d .w3d-tilt { --w3d-gx: 50%; --w3d-gy: 50%; transform-style: preserve-3d;  /* the lean itself is an inline transform (website_3d.js) */
                 transition: transform .45s cubic-bezier(.2,.8,.2,1), box-shadow .45s; }
.w3d .w3d-tilt.w3d-hot { transition: transform .12s linear, box-shadow .3s; box-shadow: 0 22px 44px -18px rgba(0,0,0,.35) !important; }
.w3d .w3d-tilt::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
                        background: radial-gradient(circle at var(--w3d-gx) var(--w3d-gy), var(--w3d-glow, rgba(255,255,255,.55)), transparent 60%); }
.w3d .w3d-tilt.w3d-hot::after { opacity: 1; }

/* blocks swing up out of the page as they scroll in */
.w3d .w3d-reveal { opacity: 0; transform: perspective(1000px) rotateX(16deg) translate3d(0, 46px, -60px); transform-origin: 50% 100%;
                   transition: opacity .8s ease var(--w3d-delay, 0ms), transform .9s cubic-bezier(.2,.8,.2,1) var(--w3d-delay, 0ms); }
.w3d .w3d-reveal.w3d-in { opacity: 1; transform: none; }

/* icons turn over on hover */
.w3d .w3d-spin { transition: transform .8s cubic-bezier(.2,.8,.2,1); transform-style: preserve-3d; }
.w3d *:hover > .w3d-spin, .w3d .w3d-spin:hover { transform: perspective(400px) rotateY(360deg) translateZ(10px); }

@media (prefers-reduced-motion: reduce) {
    .w3d .w3d-reveal { opacity: 1; transform: none; transition: none; }
    .w3d .w3d-spin, .w3d .w3d-parallax { transform: none !important; transition: none; }
}
