/* Alexandrit - "ore" layer. Everything a raw crystal does under a lamp: cut faces, a sliver of light
   travelling over an edge, colour turning from raspberry to indigo. Flat facets, no blur, no neon.
   prefers-reduced-motion switches every movement off. */

/* ---------------------------------------------------------------- the rock face behind everything */
body::before, body::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: -1; }
body::before {
    /* faint cut faces: two large facets catching lamp light in opposite corners */
    background:
        linear-gradient(118deg, rgba(176,38,96,.07) 0 18%, transparent 18.1%),
        linear-gradient(298deg, rgba(90,50,194,.08) 0 22%, transparent 22.1%),
        linear-gradient(62deg, transparent 0 74%, rgba(138,63,216,.05) 74.1% 86%, transparent 86.1%),
        var(--bg);
}
body::after {
    /* mineral grain */
    opacity: .06;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}
html, body { background: transparent; }
html { background: var(--bg); }

/* ---------------------------------------------------------------- the mark turns colour like the stone */
.mark { transition: transform .5s cubic-bezier(.2,.8,.2,1), filter .5s; }
.brand:hover .mark { transform: rotate(-8deg) scale(1.06); filter: hue-rotate(-28deg) saturate(1.15); }

/* ---------------------------------------------------------------- cards: a cut edge that catches light */
.card { position: relative; isolation: isolate; }
.card::after {
    content: ''; position: absolute; left: 14px; right: 14px; top: -1px; height: 1px; pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(224,101,155,.55) 22%, rgba(177,140,243,.6) 50%, rgba(157,178,255,.5) 78%, transparent);
    background-size: 220% 100%; background-position: 100% 0;
    opacity: .45; transition: opacity .4s, background-position 1.2s cubic-bezier(.2,.8,.2,1);
}
.card:hover::after, .job.playing::after { opacity: 1; background-position: 0 0; }
/* a chamfered corner: one cut face on the top right */
.card::before {
    content: ''; position: absolute; top: -1px; right: -1px; width: 18px; height: 18px; pointer-events: none;
    background: linear-gradient(225deg, var(--bg) 0 49%, var(--line) 50% 56%, transparent 57%);
    border-top-right-radius: var(--r);
}

/* ---------------------------------------------------------------- primary buttons: two cut faces + a glint */
.btn.primary { position: relative; overflow: hidden; background: linear-gradient(115deg, var(--vio) 0 56%, #7a37cc 56.2% 100%); border-color: transparent; }
.btn.primary:hover:not(:disabled) { background: linear-gradient(115deg, #9650e0 0 56%, #8440d6 56.2% 100%); border-color: transparent; }
.btn.primary::after {
    content: ''; position: absolute; top: -50%; bottom: -50%; left: -40%; width: 26%; pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.28), transparent);
    transform: skewX(-22deg) translateX(0); opacity: 0;
}
.btn.primary:hover:not(:disabled)::after { animation: glint .9s cubic-bezier(.3,.6,.2,1); }
@keyframes glint { 0% { transform: skewX(-22deg) translateX(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: skewX(-22deg) translateX(600%); opacity: 0; } }
#fx-preview.busy { opacity: 1; color: var(--lil); border-color: var(--vio); }
.btn.primary.busy, #fx-preview.busy { background-image: repeating-linear-gradient(120deg, rgba(255,255,255,.07) 0 10px, transparent 10px 20px); background-size: 40px 100%; animation: ore-run .8s linear infinite; }

/* ---------------------------------------------------------------- record: a turning crystal ring */
.recbtn { position: relative; }
.recbtn::before {
    content: ''; position: absolute; inset: -5px; border-radius: 50%; opacity: 0; transition: opacity .3s;
    background: conic-gradient(from 0deg, #b02660 0 25%, #a72faa 25% 50%, #8a3fd8 50% 75%, #5a32c2 75% 100%);
    -webkit-mask: radial-gradient(circle, transparent 0 calc(50% - 2px), #000 calc(50% - 1px));
            mask: radial-gradient(circle, transparent 0 calc(50% - 2px), #000 calc(50% - 1px));
}
.recbtn.on::before { opacity: 1; animation: turn 3.2s linear infinite; }
@keyframes turn { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- tags and presets: little cut gems */
.tag { clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px)); border-radius: 2px; }
.preset { position: relative; overflow: hidden; transition: border-color .25s, background .25s, transform .2s; }
.preset:hover { transform: translateY(-1px); }
.preset::after { content: ''; position: absolute; top: 0; right: 0; width: 0; height: 0; border-style: solid; border-width: 0 16px 16px 0; border-color: transparent var(--line-2) transparent transparent; transition: border-color .25s; }
.preset[data-p=studio].on::after { border-right-color: var(--crys); }
.preset[data-p=em].on::after { border-right-color: var(--prism); }
.preset[data-p=obsidian].on::after { border-right-color: var(--obs); }
.preset[data-p=fx].on::after { border-right-color: var(--vio); }

/* ---------------------------------------------------------------- progress: light running through the ore */
.prog.run i { background-image: repeating-linear-gradient(120deg, rgba(177,140,243,.45) 0 12px, rgba(138,63,216,.3) 12px 24px); background-size: 48px 100%; animation: ore-run 1s linear infinite; }
@keyframes ore-run { to { background-position: 48px 0; } }
.bar i { background: linear-gradient(90deg, var(--mag), var(--vio) 60%, var(--ind)); }
.meter i { background: linear-gradient(90deg, var(--ind), var(--vio) 55%, var(--mag) 85%, var(--warn)); background-size: 300px 100%; }
.seek .pos { background: linear-gradient(90deg, var(--mag-t), var(--vio-t)); }

/* ---------------------------------------------------------------- sliders: diamond thumbs, filled track */
input[type=range]::-webkit-slider-runnable-track { background: linear-gradient(90deg, var(--vio) 0 var(--f, 0%), var(--line-2) var(--f, 0%)); }
input[type=range]::-webkit-slider-thumb { width: 13px; height: 13px; margin-top: -4.5px; border-radius: 2px; transform: rotate(45deg); background: linear-gradient(135deg, #fff 0 50%, var(--lil) 50%); box-shadow: 0 0 0 3px var(--bg-2); transition: transform .15s; }
input[type=range]:active::-webkit-slider-thumb { transform: rotate(45deg) scale(1.25); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--vio); }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 2px; transform: rotate(45deg); background: linear-gradient(135deg, #fff 0 50%, var(--lil) 50%); }

/* ---------------------------------------------------------------- FX chain: each effect gets a facet in its family colour */
.fxc { position: relative; overflow: hidden; transition: border-color .25s, transform .2s; }
.fxc::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c, var(--vio)); clip-path: polygon(0 0, 100% 6px, 100% calc(100% - 6px), 0 100%); }
.fxc:hover { border-color: var(--line-2); }
.fxc[data-cat=time] { --c: var(--mag); } .fxc[data-cat=level] { --c: var(--crys); } .fxc[data-cat=tone] { --c: var(--orc); }
.fxc[data-cat=space] { --c: var(--vio); } .fxc[data-cat=char] { --c: var(--prism); } .fxc[data-cat=chain] { --c: var(--lil); }
.chain .fxc { animation: set-in .3s cubic-bezier(.2,.8,.2,1) both; }
@keyframes set-in { from { opacity: 0; transform: translateY(-4px); } }

/* ---------------------------------------------------------------- chips and small buttons: a sliver of light */
.chip, .btn:not(.primary), .seg button { position: relative; overflow: hidden; }
.chip::after, .seg button.on::after {
    content: ''; position: absolute; top: 0; left: -60%; width: 40%; height: 100%; pointer-events: none;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,.08), transparent); opacity: 0;
}
.chip:hover::after { animation: glint .8s ease-out; }
.chip:hover { border-color: var(--vio); color: var(--text); }

/* ---------------------------------------------------------------- headline: words cut in two tones, solid colour */
h1 em, h1 i { position: relative; }
h1 em::after, h1 i::after { content: ''; position: absolute; left: 0; right: 0; bottom: .06em; height: 2px; background: currentColor; opacity: .35; clip-path: polygon(0 0, 100% 0, 96% 100%, 0 100%); }

/* ---------------------------------------------------------------- views: a short facet wipe on enter */
.view.on { animation: in .35s cubic-bezier(.2,.8,.2,1) both; }
@keyframes in { from { opacity: 0; transform: translateY(6px); clip-path: polygon(0 0, 100% 0, 100% 92%, 0 100%); } to { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
