/* QUARTZELLE — the 3-second preloader and the crystal page transition. Both stand on a light background.
   The preloader is timed entirely here, so it lasts 3 seconds however busy the page is. */

/* ── the crystal mark (drawn in index.html, shared by both) ── */
.qz-crystal { display: block; width: 100%; height: auto; overflow: visible; }
.qz-crystal polygon { stroke: #8A7035; stroke-width: .7; stroke-linejoin: round; }
.qz-crystal .f1 { fill: #075B5B; fill-opacity: .16; }
.qz-crystal .f2 { fill: #075B5B; fill-opacity: .34; }
.qz-crystal .f3 { fill: #073B3B; fill-opacity: .56; }
.qz-crystal .f4 { fill: #FFFFFF; fill-opacity: .85; }
.qz-crystal .f5 { fill: #C9AE70; fill-opacity: .42; }
.qz-crystal g polygon { stroke-dasharray: 340; animation: cr-draw 1.1s cubic-bezier(.65, 0, .35, 1) both, cr-fill .8s ease both, cr-gleam 2.4s ease-in-out infinite; animation-delay: calc(var(--i) * 55ms), calc(.35s + var(--i) * 55ms), calc(1.2s + var(--i) * 110ms); }
.qz-crystal g { transform-origin: 100px 196px; animation: cr-rise 1.2s cubic-bezier(.16, 1, .3, 1) both; }
.qz-crystal g:nth-of-type(1) { animation-delay: .12s; }
.qz-crystal g:nth-of-type(2) { animation-delay: .22s; }
.qz-crystal .orbit { fill: none; stroke: #C9AE70; stroke-width: .9; stroke-dasharray: 150 40 60 40; transform-origin: 100px 130px; animation: cr-orbit 6s linear infinite; }
.qz-crystal .spark { fill: #C9AE70; transform-box: fill-box; transform-origin: center; animation: cr-spark 1.8s ease-in-out infinite; animation-delay: var(--d); }
.qz-crystal .shadow { fill: #073B3B; opacity: .1; }
@keyframes cr-draw { from { stroke-dashoffset: 340; } to { stroke-dashoffset: 0; } }
@keyframes cr-fill { from { fill-opacity: 0; } }
@keyframes cr-gleam { 50% { filter: brightness(1.28); } }
@keyframes cr-rise { from { transform: translateY(22px) scale(.82); opacity: 0; } }
@keyframes cr-orbit { to { stroke-dashoffset: -580; } }
@keyframes cr-spark { 0%, 100% { transform: scale(.2) rotate(0deg); opacity: 0; } 50% { transform: scale(1) rotate(90deg); opacity: 1; } }

/* ── preloader: crystal, logo, a count to 100, then the panel lifts at 2.5s and is gone at 3s ── */
.pl { position: fixed; inset: 0; z-index: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(14px, 2.6vh, 28px); background: radial-gradient(circle at 50% 40%, #FFFFFF 0, #F7F4ED 46%, #E8DED0 120%); animation: pl-lift .5s cubic-bezier(.76, 0, .24, 1) 2.5s forwards; }
.pl-off .pl { display: none; }
/* shown again on the way to the homepage: it fades in over the page first */
.pl.again { animation: pl-appear .3s ease both, pl-lift .5s cubic-bezier(.76, 0, .24, 1) 2.5s forwards; }
@keyframes pl-appear { from { opacity: 0; } }
.pl-mark { width: min(46vw, 30vh, 230px); }
.pl-logo { width: min(66vw, 320px); height: auto; animation: pl-in 1s cubic-bezier(.16, 1, .3, 1) .5s both; }
.pl-meter { display: flex; align-items: center; gap: 16px; animation: pl-in 1s cubic-bezier(.16, 1, .3, 1) .65s both; }
.pl-bar { display: block; width: min(44vw, 210px); height: 1px; background: rgba(7, 59, 59, .16); overflow: hidden; }
.pl-bar i { display: block; height: 1px; background: #073B3B; transform-origin: left; animation: pl-bar 2.45s cubic-bezier(.45, .05, .35, 1) both; }
@property --pl { syntax: '<integer>'; initial-value: 0; inherits: false; }
.pl-count { min-width: 4ch; font: 400 20px/1 'Instrument Serif', serif; color: #073B3B; font-variant-numeric: tabular-nums; counter-reset: pl var(--pl); animation: pl-count 2.45s cubic-bezier(.45, .05, .35, 1) both; }
.pl-count::after { content: counter(pl) '%'; }
@keyframes pl-in { from { opacity: 0; transform: translateY(16px); } }
@keyframes pl-bar { from { transform: scaleX(0); } }
@keyframes pl-count { from { --pl: 0; } to { --pl: 100; } }
@keyframes pl-lift { to { transform: translateY(-101%); visibility: hidden; } }

/* ── between pages: a light circle opens, the crystal turns in the middle, and the new page appears ── */
/* the new page begins to show 1.3 seconds after the click (js/lib/transition.js) */
.pt { position: fixed; inset: 0; z-index: 480; display: grid; place-items: center; background: radial-gradient(circle at 50% 46%, #FFFFFF 0, #F7F4ED 44%, #E8DED0 130%); clip-path: circle(0% at 50% 50%); visibility: hidden; transition: clip-path .46s cubic-bezier(.7, 0, .2, 1), opacity .42s ease, visibility 0s .46s; }
.pt.cover { clip-path: circle(76% at 50% 50%); visibility: visible; transition: clip-path .46s cubic-bezier(.7, 0, .2, 1), visibility 0s; }
.pt.reveal { clip-path: circle(76% at 50% 50%); opacity: 0; visibility: visible; transition: opacity .4s ease; }
.pt-mark { width: min(34vw, 24vh, 170px); transform: scale(.5) rotate(-14deg); opacity: 0; transition: transform .6s cubic-bezier(.16, 1, .3, 1), opacity .3s; }
.pt.cover .pt-mark { transform: none; opacity: 1; transition: transform 1.1s cubic-bezier(.34, 1.4, .64, 1) .1s, opacity .45s .1s; }
.pt.reveal .pt-mark { transform: scale(1.35) rotate(8deg); opacity: 0; transition: transform .5s cubic-bezier(.7, 0, .84, 0), opacity .35s; }
.pt .qz-crystal g polygon { animation-delay: calc(.1s + var(--i) * 30ms), calc(.3s + var(--i) * 30ms), calc(.75s + var(--i) * 30ms); animation-duration: .65s, .45s, .9s; }
.pt .qz-crystal g { animation-duration: .95s; }
/* tiny crystals drifting behind each part of the page (js/lib/motes.js) */
.qz-host { isolation: isolate; }
.qz-motes { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.qz-motes canvas { position: absolute; left: 0; top: 0; display: block; width: 100%; }
@media (prefers-reduced-motion: reduce) { .pt, .pl { display: none; } }
