*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-a: #faf8ff;
    --bg-b: #ede6f9;
    --bg-c: #ddd0f4;
    --violet: #3d1f7a;
    --lilac: #a889d8;
    --magenta: #c4237a;
    --cyan: #5ec5de;
    --faint: rgba(196, 35, 122, 0.13);
    --stroke-width: 1.5;
}

html {
    background:
        radial-gradient(
            ellipse at 25% 15%,
            rgba(196, 155, 235, 0.38) 0%,
            transparent 55%
        ),
        radial-gradient(
            ellipse at 78% 88%,
            rgba(94, 197, 222, 0.22) 0%,
            transparent 55%
        ),
        linear-gradient(
            158deg,
            var(--bg-a) 0%,
            var(--bg-b) 52%,
            var(--bg-c) 100%
        );
    min-height: 100%;
}

body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--violet);
}

/* ── Pearlescent background ──
   Progressive enhancement over the gradient on `html` above. background.js adds
   .ready once the first frame is drawn; the canvas is opaque, so revealing it
   any earlier would flash black. No WebGL means no .ready and the gradient stays.

   z-index 0 rather than -1 on purpose: negative-z children paint *before*
   descendant block backgrounds, so a -1 canvas would end up underneath. */
#bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.8s ease;
}

#bg.ready {
    opacity: 1;
}

main {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2.5rem 2rem 3rem;
    max-width: 680px;
    width: 100%;
    min-height: 100svh;
    container-type: inline-size; /* the h1 sizes itself off this width */
}

/* ── Sigil ── */
.sigil {
    width: 64px;
    height: auto;
    margin-bottom: 1rem;
    /*opacity: 0.75;*/
    * {
        stroke: var(--violet);
        stroke-width: 2px;
    }
}

/* ── Wordmark ── */
h1 {
    font-family: "Bellefair", serif;
    font-style: normal;
    font-weight: 400;
    /* Fill main's width exactly. "KOSMOPOLITA" in Bellefair is 7.068em of
       kerned glyphs + 10 gaps of 0.18em = 8.868em — redo the sum if the word
       or the tracking changes. */
    font-size: calc(100cqi / 8.868);
    letter-spacing: 0.18em;
    /* Browsers add tracking after the last letter too; cancel it so the word
       centres on its glyphs rather than sitting 0.09em left. */
    margin-right: -0.18em;
    color: var(--magenta);
    opacity: 0.92;
    text-transform: uppercase;
    margin-bottom: 0.3rem;
}

/* ── Tagline ── */
.tagline {
    font-family: "Cinzel", serif;
    font-weight: 400;
    font-size: calc(100cqi / 25);
    letter-spacing: 0.2em;
    text-transform: none;
    color: var(--violet);
    opacity: 0.9;
    margin-bottom: 0;
}

/* ── Rule ── */
.rule {
    width: 100%;
    height: 1px;
    border: none;
    background: var(--violet);
    margin: 1rem 0;
}

/* ── Quote block ── */
.quote-block {
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 46vh;
    margin-bottom: 2.5rem;
    padding: 0 0.5rem;
}

/* ── Quote transition ──
   Blur fade on the block itself, so the blockquote's DOM (and its aria-live
   region, text selection and copy/paste) stays intact.

   The base .quote-block above sets no opacity and no filter, so its resting
   state is exactly the end state of quoteBlurIn. That is what stops the class
   removal from flashing: by the time .entering is dropped on animationend, the
   computed result already matches the base style. */
.quote-block.fading {
    animation: quoteBlurOut 0.38s ease forwards;
}

.quote-block.entering {
    animation: quoteBlurIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes quoteBlurOut {
    to {
        opacity: 0;
        filter: blur(6px);
    }
}

@keyframes quoteBlurIn {
    from {
        opacity: 0;
        filter: blur(8px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    #bg {
        transition: none;
    }

    /* Opacity only, no blur — but still real animations, so animationend keeps
       firing and the JS never has to fall back to its safety timeout. */
    .quote-block.fading {
        animation: quoteFadeOut 0.15s ease forwards;
    }

    .quote-block.entering {
        animation: quoteFadeIn 0.15s ease both;
    }
}

@keyframes quoteFadeOut {
    to {
        opacity: 0;
    }
}

@keyframes quoteFadeIn {
    from {
        opacity: 0;
    }
}

blockquote {
    font-family: "Cormorant Garamond", serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(2rem, 5.5vw, 3.8rem);
    line-height: 1.4;
    color: var(--violet);
    margin-bottom: 1.6rem;
}

blockquote::before,
blockquote::after {
    content: "";
}

cite {
    display: block;
    font-family: "Cinzel", serif;
    font-style: normal;

    font-size: calc(100cqi / 50);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--magenta);
    opacity: 0.8;
    margin-bottom: 0.9rem;
}

.hint {
    display: block;
    font-family: "Cinzel", serif;
    font-size: calc(100cqi / 50);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--lilac);
    opacity: 0.6;
}

/* ── Contact nav ── */
nav {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

nav a {
    font-family: "Cinzel", serif;
    font-size: calc(100cqi / 50);
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--magenta);
    text-decoration: none;
    transition: color 0.2s ease;
}

nav a:hover {
    color: var(--cyan);
}

.dot {
    color: var(--lilac);
    opacity: 0.5;
    font-size: 0.5rem;
    line-height: 1;
}
