/* ==========================================================================
   purensight — austere design system
   an austere space for presence
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@200;300;400;500&display=swap');

/* --- View Transitions API --- */
@view-transition {
    navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.8s;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

:root {
    --font-serif: 'Georgia', -apple-system, BlinkMacSystemFont, 'Times New Roman', serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    --color-text-primary: #0e0e10;
    --color-text-secondary: #2b2b30;
    --color-text-muted: rgba(0, 0, 0, 0.6);
    --color-text-light: rgba(255, 255, 255, 0.85);
    --color-text-whisper: rgba(255, 255, 255, 0.55);
    
    /* Crisp milk-glass background with high contrast for crystal-clear legibility */
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(255, 255, 255, 0.75);
    --card-shadow: 0 16px 45px rgba(0, 0, 0, 0.18);
    --card-blur: blur(20px);
    
    --transition-slow: 3.5s cubic-bezier(0.22, 1, 0.36, 1);
    --transition-med: 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    --transition-fast: 0.3s ease;
}

/* --- Base & Viewport --- */
html, body {
    scrollbar-gutter: stable overlay;
    overscroll-behavior: none;
    overflow: hidden;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    background-color: #000;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-serif);
    color: var(--color-text-primary);
    opacity: 0;
    transition: opacity 2.5s cubic-bezier(0.25, 1, 0.5, 1);
}

body.bg-loaded {
    opacity: 1;
}

body.page-leaving {
    opacity: 0 !important;
    transition: opacity 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

/* --- Card Glassmorphism --- */
.passage-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 44px 48px;
    border-radius: 14px;
    max-width: 560px;
    width: 90%;
    box-shadow: var(--card-shadow);
    text-align: left;
    margin: 20px;
    transition: opacity 3.5s cubic-bezier(0.22, 1, 0.36, 1), transform 3.5s cubic-bezier(0.22, 1, 0.36, 1);
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    backdrop-filter: var(--card-blur);
    -webkit-backdrop-filter: var(--card-blur);
    max-height: 80vh;
    overflow-y: auto;
    scrollbar-width: none;
    z-index: 10;
}

.passage-card::-webkit-scrollbar {
    display: none;
}

.passage-card.fade-in {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* --- Crisp, High-Legibility Typography --- */
#display-title {
    margin: 0 0 6px 0;
    font-size: 1.65rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #050508;
}

#display-subtitle, #display-number {
    display: block;
    margin-bottom: 22px;
    color: #383840;
    font-style: italic;
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.02em;
}

#display-passage {
    white-space: pre-wrap;
    line-height: 1.95;
    color: #0e0e12;
    font-size: 1.25rem;
    font-weight: 400;
    letter-spacing: 0.01em;
    text-rendering: optimizeLegibility;
}

.page-label-link {
    text-decoration: none;
    color: inherit;
    display: inline;
}

.page-label-link:hover .page-label {
    text-decoration: underline;
    text-underline-offset: 3px;
    color: #000;
}

/* --- Orb Navigation System --- */
@keyframes orbPulseSlow {
    0% { transform: scale(1); filter: brightness(100%) drop-shadow(0 0 6px rgba(255,255,255,0.15)); }
    50% { transform: scale(1.10); filter: brightness(30%) drop-shadow(0 0 18px rgba(255,255,255,0.25)); }
    100% { transform: scale(1); filter: brightness(100%) drop-shadow(0 0 6px rgba(255,255,255,0.15)); }
}

.nav-container {
    position: fixed;
    bottom: 40px;
    right: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    z-index: 200;
}

.orb-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.orb-link {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: inherit;
    position: relative;
}

.orb-btn {
    width: 65px;
    height: 65px;
    cursor: pointer;
    opacity: 0.45;
    border-radius: 50%;
    object-fit: contain;
    transition: opacity 0.5s ease, transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), filter 0.5s ease;
    animation: orbPulseSlow 8s ease-in-out infinite;
    user-select: none;
    -webkit-user-drag: none;
}

.orb-wrap:nth-child(1) .orb-btn { animation-duration: 7.5s; animation-delay: -1s; }
.orb-wrap:nth-child(2) .orb-btn { animation-duration: 9s; animation-delay: -3.5s; }
.orb-wrap:nth-child(3) .orb-btn { animation-duration: 6.8s; animation-delay: -5s; }

.orb-wrap:hover .orb-btn,
.orb-link:hover .orb-btn {
    opacity: 1;
    transform: scale(1.12);
    filter: brightness(110%) drop-shadow(0 0 20px rgba(255, 255, 255, 0.6));
    animation-play-state: paused;
}

.orb-btn.active-orb {
    opacity: 0.8;
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.45));
}

/* Ethereal Mist Whisper Tooltip — Slow 1.5s Fade-In */
.orb-whisper {
    position: absolute;
    right: calc(100% + 18px);
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 300;
    letter-spacing: 0.16em;
    text-transform: lowercase;
    color: rgba(255, 255, 255, 0.95);
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 1.5s cubic-bezier(0.22, 1, 0.36, 1), transform 1.5s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: auto;
    cursor: pointer;
}

.orb-wrap:hover .orb-whisper,
.orb-link:hover .orb-whisper {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    transition: opacity 1.5s cubic-bezier(0.22, 1, 0.36, 1), transform 1.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* --- Sound Toggle Button --- */
.sound-toggle {
    position: fixed;
    top: 28px;
    right: 28px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: rgba(255, 255, 255, 0.9);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 300;
    letter-spacing: 0.14em;
    text-transform: lowercase;
    padding: 8px 18px;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.4s ease;
    z-index: 250;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    user-select: none;
}

.sound-toggle:hover {
    background: rgba(255, 255, 255, 0.32);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.sound-toggle.is-active {
    background: rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.6);
    color: #fff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

/* --- Footer & Copyright --- */
.copyright-container {
    position: fixed;
    bottom: 24px;
    left: 24px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    z-index: 100;
}

.copyright {
    color: var(--color-text-whisper);
    font-size: 0.72rem;
    font-family: var(--font-sans);
    font-weight: 300;
    letter-spacing: 0.08em;
    text-transform: lowercase;
    text-decoration: none;
    transition: color 0.4s ease;
}

a.copyright:hover {
    color: rgba(255, 255, 255, 0.95);
}

/* --- Responsive Adaptations for Desktop, Tablets & Cell Phones --- */
@media (max-width: 768px) {
    html, body {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    body {
        align-items: center;
        padding: 20px 0 80px;
        box-sizing: border-box;
        min-height: 100vh;
        height: auto;
    }

    .passage-card {
        padding: 32px 22px;
        width: calc(100% - 36px);
        max-width: 500px;
        max-height: 75vh;
        margin: 15px auto 40px;
        border-radius: 12px;
    }
    
    #display-title {
        font-size: 1.45rem;
    }

    #display-passage {
        font-size: 1.15rem;
        line-height: 1.85;
    }

    .nav-container {
        right: 16px;
        bottom: 18px;
        gap: 12px;
    }
    
    .orb-btn {
        width: 46px !important;
        height: 46px !important;
    }
    
    .orb-whisper {
        display: none;
    }
    
    .copyright-container {
        left: 16px;
        bottom: 16px;
        gap: 4px;
    }
    
    .sound-toggle {
        top: 14px;
        right: 14px;
        padding: 6px 14px;
        font-size: 0.72rem;
    }
}
