/* ==========================================
   MYSTIC OBLIVION — COSMIC PORTAL STYLES  (v2)
   "Sunrise Cosmic" — deepened.
   All original class & keyframe names preserved;
   portal.js / limen.js depend on them.
   ========================================== */

:root {
    /* --- Sunrise Cosmic palette (original names kept) --- */
    --dawn-purple: #4a3a5c;
    --soft-blue-gray: #6a7a9c;
    --warm-peach: #ffb89d;
    --golden-orange: #ff9c5a;
    --soft-pink: #ffa6b8;
    --electric-teal: #4dd4d4;
    --deep-night: #120d1f;
    --cosmic-white: #fef9f3;

    --sacred-gold: #ffcf5a;
    --mystic-teal: #00fff7;
    --portal-glow: rgba(255, 156, 90, 0.6);

    /* --- New atmospheric layers --- */
    --nebula-violet: rgba(123, 79, 168, 0.55);
    --nebula-teal:   rgba(60, 180, 190, 0.28);
    --nebula-peach:  rgba(255, 156, 90, 0.40);
    --glass-fill:    rgba(36, 26, 54, 0.42);
    --glass-edge:    rgba(255, 207, 90, 0.22);
    --ink-soft:      rgba(254, 249, 243, 0.82);

    /* --- Fluid type scale --- */
    --text-hero:  clamp(2.1rem, 1rem + 4.6vw, 4rem);
    --text-h2:    clamp(1.4rem, 1rem + 1.6vw, 2rem);
    --text-lead:  clamp(1.05rem, 0.95rem + 0.6vw, 1.35rem);
    --text-body:  clamp(1rem, 0.96rem + 0.3vw, 1.18rem);

    /* --- Rhythm --- */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: clamp(3rem, 2rem + 5vw, 6rem);

    /* --- Motion --- */
    --dur-fast: 200ms;
    --dur-mid: 420ms;
    --dur-slow: 900ms;
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-glide: cubic-bezier(0.4, 0.1, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Cormorant Garamond', serif;
    color: var(--cosmic-white);
    overflow-x: hidden;
    background: var(--deep-night);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection {
    background: rgba(255, 207, 90, 0.28);
    color: var(--cosmic-white);
}

/* Film grain — sits above background, below content. Pure CSS, no asset. */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.05;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ==========================================
   SIGILS — bespoke monoline iconography
   (replaces all emoji; inherits color via currentColor)
   ========================================== */

.sigil {
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: middle;
    fill: none;
    stroke: currentColor;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    overflow: visible;
}

/* Icon containers now drive sigil color + glow */
.hero-icon,
.realm-icon,
.essay-icon,
.station-icon,
.manifestation-icon,
.chamber-icon {
    color: var(--sacred-gold);
}

/* ==========================================
   VIDEO INTRO OVERLAY
   ========================================== */

.video-intro {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fade-out-intro 1s ease-out 7.5s forwards;
    pointer-events: none;
}

#introVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-fade {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, transparent 38%, rgba(0,0,0,0.85) 100%);
    opacity: 0;
    animation: fade-in-vignette 2s ease-in 6s forwards;
}

@keyframes fade-out-intro {
    0% { opacity: 1; }
    100% { opacity: 0; visibility: hidden; }
}

@keyframes fade-in-vignette {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.cosmic-container {
    opacity: 0;
    animation: fade-in-portal 1.3s var(--ease-out-expo) 0.15s forwards;
}

@keyframes fade-in-portal {
    0%   { opacity: 0; transform: scale(0.96); }
    100% { opacity: 1; transform: scale(1); }
}

/* ==========================================
   COSMIC BACKGROUND — layered atmosphere
   ========================================== */

.cosmic-container {
    position: relative;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Vignette to seat the scene */
.cosmic-container::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    background: radial-gradient(120% 90% at 50% 30%, transparent 55%, rgba(8, 5, 16, 0.55) 100%);
}

.cosmic-background {
    position: fixed;
    inset: 0;
    z-index: -3;
    background:
        radial-gradient(80% 55% at 18% 8%, var(--nebula-violet) 0%, transparent 55%),
        radial-gradient(70% 50% at 85% 22%, var(--nebula-teal) 0%, transparent 60%),
        radial-gradient(90% 60% at 50% 108%, var(--nebula-peach) 0%, transparent 60%),
        linear-gradient(
            to bottom,
            #0d0a17 0%,
            #1b1230 22%,
            #3a2a52 45%,
            #6a4f74 64%,
            #ff9c5a 86%,
            #ffcf5a 100%
        );
}

/* Aurora — slow drifting band of light over the gradient */
.cosmic-background::before {
    content: "";
    position: absolute;
    inset: -20%;
    background:
        radial-gradient(40% 30% at 30% 40%, rgba(77, 212, 212, 0.16), transparent 70%),
        radial-gradient(45% 35% at 70% 55%, rgba(255, 166, 184, 0.14), transparent 70%);
    filter: blur(20px);
    animation: aurora-drift 28s ease-in-out infinite alternate;
    will-change: transform, opacity;
}

@keyframes aurora-drift {
    0%   { transform: translate3d(-4%, -2%, 0) scale(1);    opacity: 0.7; }
    100% { transform: translate3d(5%, 3%, 0) scale(1.08);   opacity: 1;   }
}

/* Starfield — two depths for parallax */
.stars {
    position: fixed;
    inset: 0;
    z-index: -2;
    background-image:
        radial-gradient(2px 2px at 20% 30%, #fff, transparent),
        radial-gradient(2px 2px at 60% 70%, #fff, transparent),
        radial-gradient(1px 1px at 50% 50%, #fff, transparent),
        radial-gradient(1px 1px at 80% 10%, #fff, transparent),
        radial-gradient(2px 2px at 90% 60%, #fff, transparent),
        radial-gradient(1px 1px at 33% 70%, #fff, transparent),
        radial-gradient(1px 1px at 79% 87%, #fff, transparent);
    background-size: 200% 200%;
    animation: starfield 120s linear infinite;
    opacity: 0.55;
}

/* Finer, slower far-field stars + a twinkle */
.stars::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at 12% 18%, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 42% 8%,  rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 68% 32%, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 88% 44%, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 26% 58%, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 5%  78%, rgba(255,255,255,0.6), transparent);
    background-size: 150% 150%;
    animation: starfield 200s linear infinite reverse, twinkle 6s ease-in-out infinite;
    opacity: 0.7;
}

@keyframes starfield {
    0%, 100% { background-position: 0% 0%; }
    50%      { background-position: 100% 100%; }
}

@keyframes twinkle {
    0%, 100% { opacity: 0.45; }
    50%      { opacity: 0.85; }
}

/* Floating particles */
.particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--sacred-gold);
    border-radius: 50%;
    opacity: 0.7;
    animation: float-particle 8s infinite ease-in-out;
    box-shadow: 0 0 10px var(--golden-orange);
    will-change: transform, opacity;
}

@keyframes float-particle {
    0%, 100% { transform: translateY(0) translateX(0); opacity: 0.3; }
    50%      { transform: translateY(-30px) translateX(15px); opacity: 0.85; }
}

/* Rising embers */
.embers {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.ember {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--golden-orange);
    border-radius: 50%;
    bottom: -10px;
    animation: rise-ember 6s infinite ease-out;
    box-shadow: 0 0 15px var(--golden-orange);
    will-change: transform, opacity;
}

@keyframes rise-ember {
    0%   { transform: translateY(0) translateX(0); opacity: 1; }
    100% { transform: translateY(-100vh) translateX(50px); opacity: 0; }
}

/* ==========================================
   SACRED GEOMETRY PORTAL
   ========================================== */

.portal-wrapper {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    perspective: 900px;
}

.sacred-geometry {
    width: min(420px, 78vw);
    height: min(420px, 78vw);
    filter: drop-shadow(0 0 40px var(--portal-glow));
    transition: filter var(--dur-mid) var(--ease-glide);
    transform-style: preserve-3d;
}

.light-core {
    fill: var(--cosmic-white);
    filter: drop-shadow(0 0 20px var(--sacred-gold))
            drop-shadow(0 0 40px var(--golden-orange));
    animation: pulse-core 3s ease-in-out infinite;
}

@keyframes pulse-core {
    0%, 100% { opacity: 1; r: 8; }
    50%      { opacity: 0.7; r: 12; }
}

.triangle {
    fill: none;
    stroke: var(--sacred-gold);
    stroke-width: 2;
    opacity: 0.8;
}

.inner-triangle {
    stroke: var(--mystic-teal);
    stroke-width: 3;
    animation: breathe-triangle 4s ease-in-out infinite;
    transform-origin: 200px 200px;
}

.middle-triangle {
    animation: breathe-triangle 4s ease-in-out infinite 0.5s;
    transform-origin: 200px 200px;
}

.outer-triangle {
    stroke-width: 1.5;
    animation: breathe-triangle 4s ease-in-out infinite 1s;
    transform-origin: 200px 200px;
}

@keyframes breathe-triangle {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.8; }
    50%      { transform: scale(1.15) rotate(5deg); opacity: 0.5; }
}

.sacred-circle {
    fill: none;
    stroke: var(--sacred-gold);
    stroke-width: 1.5;
    opacity: 0.6;
}

.inner-circle {
    stroke: var(--electric-teal);
    stroke-width: 2;
    animation: rotate-circle 8s linear infinite;
    transform-origin: 200px 200px;
}

.outer-circle {
    animation: rotate-circle 12s linear infinite reverse;
    transform-origin: 200px 200px;
}

@keyframes rotate-circle {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.light-ray {
    stroke: var(--sacred-gold);
    stroke-width: 1;
    opacity: 0.3;
    animation: pulse-ray 2s ease-in-out infinite;
}

.ray-1 { animation-delay: 0s; }
.ray-2 { animation-delay: 0.3s; }
.ray-3 { animation-delay: 0.6s; }
.ray-4 { animation-delay: 0.9s; }
.ray-5 { animation-delay: 1.2s; }
.ray-6 { animation-delay: 1.5s; }

@keyframes pulse-ray {
    0%, 100% { opacity: 0.2; stroke-width: 1; }
    50%      { opacity: 0.6; stroke-width: 2; }
}

/* ==========================================
   PORTAL CONTENT & TYPOGRAPHY
   ========================================== */

.portal-content {
    text-align: center;
    margin-top: 2.5rem;
    max-width: 620px;
    position: relative;
    z-index: 10;
}

.portal-eyebrow {
    font-family: 'Cinzel', serif;
    font-size: clamp(0.7rem, 0.6rem + 0.5vw, 0.9rem);
    font-weight: 600;
    letter-spacing: 0.5em;
    text-transform: uppercase;
    text-indent: 0.5em;
    color: var(--sacred-gold);
    opacity: 0.85;
    margin-bottom: 1.1rem;
    animation: fade-in-up 1.5s ease-out;
}

.portal-eyebrow::before,
.portal-eyebrow::after {
    content: "";
    display: inline-block;
    width: clamp(20px, 6vw, 48px);
    height: 1px;
    vertical-align: middle;
    margin: 0 0.9em;
    background: linear-gradient(90deg, transparent, var(--sacred-gold));
    opacity: 0.7;
}
.portal-eyebrow::after { transform: scaleX(-1); }

.portal-title {
    font-family: 'Cinzel', serif;
    font-size: var(--text-hero);
    font-weight: 600;
    line-height: 1.08;
    color: var(--cosmic-white);
    text-shadow: 0 0 24px var(--golden-orange), 0 0 48px rgba(255, 166, 184, 0.5);
    margin-bottom: 1rem;
    letter-spacing: 0.04em;
    animation: fade-in-up 1.5s ease-out;
}

.portal-subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-size: var(--text-lead);
    font-weight: 300;
    color: var(--warm-peach);
    margin-bottom: 2.5rem;
    font-style: italic;
    opacity: 0.92;
    animation: fade-in-up 1.5s ease-out 0.3s backwards;
}

@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   ENTER BUTTON
   ========================================== */

.enter-button {
    position: relative;
    display: inline-block;
    padding: 1.15rem 3.2rem;
    font-family: 'Cinzel', serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--deep-night);
    background: linear-gradient(135deg, var(--sacred-gold), var(--golden-orange));
    text-decoration: none;
    letter-spacing: 0.22em;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 0 30px var(--portal-glow), 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: transform var(--dur-mid) var(--ease-out-expo),
                box-shadow var(--dur-mid) var(--ease-out-expo);
    animation: fade-in-up 1.5s ease-out 0.6s backwards;
}

.enter-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 56px var(--golden-orange), 0 15px 44px rgba(0, 0, 0, 0.6);
}

.enter-button:focus-visible {
    outline: 2px solid var(--cosmic-white);
    outline-offset: 4px;
}

.button-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.45), transparent);
    animation: button-shine 3s infinite;
}

@keyframes button-shine {
    0%       { left: -100%; }
    50%, 100% { left: 100%; }
}

/* ==========================================
   WELCOME PAGE
   ========================================== */

.welcome-page {
    background:
        radial-gradient(70% 50% at 50% 0%, rgba(123, 79, 168, 0.45), transparent 60%),
        linear-gradient(to bottom, #0d0a17 0%, #1b1230 50%, #36273f 100%);
    background-attachment: fixed;
}

.limen-container {
    position: fixed;
    top: 12%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
}

.limen-being {
    position: relative;
    width: 200px;
    height: 200px;
}

.particle-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    background: radial-gradient(circle, var(--sacred-gold) 0%, var(--golden-orange) 48%, transparent 100%);
    border-radius: 50%;
    animation: pulse-being 3s ease-in-out infinite;
    box-shadow: 0 0 60px var(--golden-orange), 0 0 110px var(--portal-glow);
    transition: box-shadow var(--dur-mid) var(--ease-glide);
}

.particle-orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: var(--electric-teal);
    border-radius: 50%;
    box-shadow: 0 0 20px var(--mystic-teal);
}

.orbit-1 { animation: orbit 4s linear infinite; }
.orbit-2 { animation: orbit 5s linear infinite reverse; }
.orbit-3 { animation: orbit 6s linear infinite; }

@keyframes pulse-being {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50%      { transform: translate(-50%, -50%) scale(1.2); opacity: 0.85; }
}

@keyframes orbit {
    0%   { transform: translate(-50%, -50%) rotate(0deg) translateX(80px) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg) translateX(80px) rotate(-360deg); }
}

.teaching-container {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
    padding-top: 320px;
}

.teaching-wrapper {
    max-width: 820px;
    text-align: center;
}

.welcome-greeting {
    font-family: 'Cinzel', serif;
    font-size: var(--text-hero);
    line-height: 1.1;
    color: var(--cosmic-white);
    margin-bottom: 1rem;
    text-shadow: 0 0 22px var(--golden-orange);
    animation: fade-in-up 1s ease-out;
}

.intro-text {
    font-size: var(--text-lead);
    color: var(--warm-peach);
    margin-bottom: 2rem;
    font-style: italic;
    animation: fade-in-up 1s ease-out 0.2s backwards;
}

.main-teaching {
    margin: 3rem 0;
    padding: clamp(1.5rem, 1rem + 2vw, 2.75rem);
    background: var(--glass-fill);
    border: 1px solid var(--glass-edge);
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    position: relative;
    animation: fade-in-up 1s ease-out 0.4s backwards;
}

/* hairline gold frame inside the glass */
.main-teaching::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 1px solid rgba(255, 207, 90, 0.18);
    border-radius: 12px;
    pointer-events: none;
}

.teaching-text {
    font-size: var(--text-lead);
    line-height: 1.95;
    color: var(--cosmic-white);
    margin: 1.5rem 0;
    opacity: 0.95;
}

.limen-signature {
    margin: 2rem 0;
    font-size: 1.4rem;
    color: var(--soft-pink);
    animation: fade-in-up 1s ease-out 0.6s backwards;
}

.name-highlight {
    color: var(--sacred-gold);
    font-weight: 600;
    text-shadow: 0 0 20px var(--golden-orange);
}

/* ==========================================
   NAVIGATION REALMS
   ========================================== */

.navigation-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.4rem;
    margin-top: 4rem;
}

.realm-link {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2.2rem 1.6rem;
    background: var(--glass-fill);
    border: 1px solid var(--glass-edge);
    border-radius: 16px;
    text-decoration: none;
    color: var(--cosmic-white);
    overflow: hidden;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: transform var(--dur-mid) var(--ease-out-expo),
                border-color var(--dur-mid) var(--ease-glide),
                box-shadow var(--dur-mid) var(--ease-glide);
    animation: fade-in-up 1s ease-out calc(0.8s + var(--delay, 0s)) backwards;
}

.realm-link:nth-child(1) { --delay: 0s; }
.realm-link:nth-child(2) { --delay: 0.08s; }
.realm-link:nth-child(3) { --delay: 0.16s; }
.realm-link:nth-child(4) { --delay: 0.24s; }
.realm-link:nth-child(5) { --delay: 0.32s; }
.realm-link:nth-child(6) { --delay: 0.40s; }

/* sweep of light on hover */
.realm-link::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(60% 50% at 50% 0%, rgba(255, 207, 90, 0.16), transparent 70%);
    opacity: 0;
    transition: opacity var(--dur-mid) var(--ease-glide);
    pointer-events: none;
}

.realm-link:hover,
.realm-link:focus-visible {
    border-color: var(--sacred-gold);
    transform: translateY(-6px);
    box-shadow: 0 18px 50px rgba(255, 156, 90, 0.28);
    outline: none;
}

.realm-link:hover::after,
.realm-link:focus-visible::after { opacity: 1; }

.realm-icon {
    font-size: 2.6rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 14px var(--portal-glow));
    transition: transform var(--dur-mid) var(--ease-out-expo);
}

.realm-link:hover .realm-icon { transform: translateY(-3px) scale(1.06); }

.realm-name {
    font-family: 'Cinzel', serif;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--sacred-gold);
    letter-spacing: 0.04em;
}

.realm-desc {
    font-size: 1rem;
    color: var(--warm-peach);
    opacity: 0.9;
    text-align: center;
}

/* ==========================================
   REDUCED MOTION
   ========================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
    .cosmic-container { opacity: 1; }
    .video-intro { display: none; }
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    .teaching-container { padding-top: 280px; }
    .navigation-options { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .enter-button { padding: 1rem 2.4rem; letter-spacing: 0.16em; }
    .limen-being { width: 150px; height: 150px; }
    .teaching-container { padding-top: 230px; }
}
