/* Opening screen (js/splash.js): "The Universal Office" when the app is first opened in a browser session;
   it plays for about five seconds, then waits for a tap. Dark navy and gold, a ring that draws itself around a cross, the name rising out of a wide
   letter-spacing, then the five traditions. Self-contained: it does not depend on the app's own theme or on
   Google Fonts, so it looks the same on the first visit and offline. */

@font-face {
    font-family: 'UO Splash Cinzel';
    src: url('/assets/fonts/Cinzel-latin.woff2') format('woff2');
    font-weight: 400 900;
    font-style: normal;
    font-display: block;   /* the name is never shown in a fallback face that then jumps */
}
@font-face {
    font-family: 'UO Splash Cormorant';
    src: url('/assets/fonts/CormorantGaramond-Italic.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

html.uo-splash-on, html.uo-splash-on body { overflow: hidden; }

#uo-splash {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
    color: #e9d9a6;
    text-align: center;
    background:
        radial-gradient(ellipse 80% 55% at 50% 36%, #1c2a66 0%, rgba(28, 42, 102, 0) 70%),
        radial-gradient(ellipse at 50% 40%, #0d1438 0%, #070a1d 60%, #03040c 100%);
    opacity: 1;
    transition: opacity 0.6s ease;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
#uo-splash.uo-splash-out { opacity: 0; pointer-events: none; }

/* A few gold specks, like candles seen far off, drifting very slowly. */
#uo-splash::before {
    content: '';
    position: absolute;
    inset: -10%;
    background-image:
        radial-gradient(circle at 12% 22%, rgba(233, 205, 130, 0.55) 0 1.2px, transparent 2px),
        radial-gradient(circle at 82% 16%, rgba(233, 205, 130, 0.45) 0 1px, transparent 2px),
        radial-gradient(circle at 30% 78%, rgba(233, 205, 130, 0.40) 0 1.4px, transparent 2px),
        radial-gradient(circle at 70% 84%, rgba(233, 205, 130, 0.50) 0 1.1px, transparent 2px),
        radial-gradient(circle at 92% 58%, rgba(233, 205, 130, 0.35) 0 1px, transparent 2px),
        radial-gradient(circle at 6% 60%, rgba(233, 205, 130, 0.40) 0 1.2px, transparent 2px),
        radial-gradient(circle at 54% 8%, rgba(233, 205, 130, 0.35) 0 1px, transparent 2px);
    animation: uo-sp-drift 5s ease-in-out both;
    pointer-events: none;
}

.uo-sp-mark {
    position: relative;
    width: min(46vw, 210px);
    aspect-ratio: 1;
    flex: none;
}
.uo-sp-glow {
    position: absolute;
    inset: -45%;
    background: radial-gradient(circle, rgba(245, 214, 120, 0.42) 0%, rgba(245, 214, 120, 0.12) 38%, rgba(245, 214, 120, 0) 66%);
    opacity: 0;
    animation: uo-sp-glow 5s ease-in-out both;
}
.uo-sp-mark svg { position: relative; display: block; width: 100%; height: 100%; overflow: visible; }
.uo-sp-ring {
    fill: none;
    stroke: #c9a84c;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-dasharray: 578;
    stroke-dashoffset: 578;
    animation: uo-sp-draw 2.6s cubic-bezier(0.5, 0, 0.2, 1) 0.3s forwards;
}
.uo-sp-cross {
    opacity: 0;
    transform-origin: 100px 100px;
    animation: uo-sp-cross 1.6s ease-out 0.9s forwards;
    filter: drop-shadow(0 0 7px rgba(245, 214, 120, 0.55));
}

.uo-sp-name {
    margin: clamp(26px, 6vh, 44px) 0 0;
    font-family: 'UO Splash Cinzel', 'Cinzel', 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
    line-height: 1.12;
    text-transform: uppercase;
}
.uo-sp-the {
    display: block;
    font-size: clamp(13px, 3.6vw, 17px);
    letter-spacing: 0.55em;
    padding-left: 0.55em;   /* balances the trailing letter-spacing so the word is truly centred */
    color: #b89a52;
    opacity: 0;
    animation: uo-sp-rise 1.2s ease-out 1.5s forwards;
}
.uo-sp-main {
    display: block;
    margin-top: 0.35em;
    font-size: clamp(26px, 8.4vw, 46px);
    letter-spacing: 0.16em;
    padding-left: 0.16em;
    background: linear-gradient(180deg, #fbefc0 0%, #e2c571 45%, #a98338 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    opacity: 0;
    animation: uo-sp-name 1.9s cubic-bezier(0.2, 0.7, 0.2, 1) 1.8s forwards;
}
.uo-sp-main span { display: block; }

.uo-sp-rule {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: clamp(18px, 4vh, 30px) 0 14px;
    width: min(70vw, 300px);
    opacity: 0;
    animation: uo-sp-rise 1.2s ease-out 3.0s forwards;
}
.uo-sp-rule::before, .uo-sp-rule::after {
    content: '';
    height: 1px;
    flex: 1;
    background: linear-gradient(90deg, rgba(201, 168, 76, 0), rgba(201, 168, 76, 0.75));
}
.uo-sp-rule::after { transform: scaleX(-1); }
.uo-sp-rule i { font-style: normal; color: #c9a84c; font-size: 14px; }

.uo-sp-lines {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 0;
    max-width: 92vw;
    margin: 0;
    padding: 0;
    list-style: none;
    font-family: 'UO Splash Cormorant', 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-size: clamp(15px, 4.2vw, 19px);
    color: #cdbd90;
    opacity: 0;
    animation: uo-sp-rise 1.4s ease-out 3.3s forwards;
}
.uo-sp-lines li:not(:last-child)::after { content: '\2726'; color: #8f7637; margin: 0 0.7em; font-style: normal; font-size: 0.7em; vertical-align: 0.12em; }

.uo-sp-hint {
    position: absolute;
    left: 0; right: 0;
    bottom: max(22px, env(safe-area-inset-bottom));
    font: 12px/1.2 system-ui, sans-serif;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(225, 205, 150, 0.8);
    opacity: 0;
    /* appears once the picture is complete, then breathes gently until tapped */
    animation: uo-sp-rise 1s ease-out 4.6s forwards, uo-sp-breathe 3s ease-in-out 5.8s infinite;
}

@keyframes uo-sp-draw { to { stroke-dashoffset: 0; } }
@keyframes uo-sp-cross {
    from { opacity: 0; transform: scale(0.86); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes uo-sp-glow {
    0%   { opacity: 0; transform: scale(0.8); }
    35%  { opacity: 1; }
    70%  { opacity: 0.8; transform: scale(1.04); }
    100% { opacity: 0.9; transform: scale(1); }
}
@keyframes uo-sp-rise {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes uo-sp-name {
    from { opacity: 0; letter-spacing: 0.5em; transform: translateY(6px); }
    to   { opacity: 1; letter-spacing: 0.16em; transform: translateY(0); }
}
@keyframes uo-sp-drift {
    from { transform: translateY(14px); opacity: 0; }
    30%  { opacity: 1; }
    to   { transform: translateY(-14px); opacity: 1; }
}
@keyframes uo-sp-breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* People who ask their device for less motion get the finished picture at once. */
@media (prefers-reduced-motion: reduce) {
    #uo-splash, #uo-splash *, #uo-splash::before { animation: none !important; }
    #uo-splash { transition: none; }
    .uo-sp-ring { stroke-dashoffset: 0; }
    .uo-sp-glow, .uo-sp-cross, .uo-sp-the, .uo-sp-main, .uo-sp-rule, .uo-sp-lines { opacity: 1; }
    .uo-sp-glow { opacity: 0.8; }
    .uo-sp-hint { opacity: 1; }
}
