/* Base styles */
:root {
    --black: #000000;
    --dark-gray: #121212;
    --medium-gray: #2a2a2a;
    --light-gray: #aaaaaa;
    --white: #ffffff;
    --red: #c04646;
    --dark-red: #8b0000;
    --orange: #ff6e27;
    --purple: #9358b6;
    --deep-purple: #4a235a;
    --rune-opacity: 0.5; /* Max opacity for runes */
}

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

body {
    background-color: var(--black);
    color: var(--white);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 300;
    line-height: 1.6;
    height: 100vh;
    overflow-x: hidden;
    position: relative;
}



/* Technical background animations - CSS based */
.tech-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: 50px 50px;
    background-image:
        linear-gradient(to right, rgba(85, 0, 189, 0.07) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(85, 0, 189, 0.07) 1px, transparent 1px);
    pointer-events: none;
    z-index: 1;
}

/* Rune animation container */
.rune-rain-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    z-index: -1; /* Move behind content */
    pointer-events: none;
}

/* Add a combined fade-in and scroll animation */
@keyframes runeRain {
    0% { transform: translateY(-120vh); opacity: 0; visibility: hidden; }
    0.1% { visibility: visible; opacity: 0; transform: translateY(-120vh); } /* Just became visible but still transparent */
    5% { transform: translateY(-120vh); opacity: 0; visibility: visible; } /* Hold at top, invisible but ready */
    15% { transform: translateY(-120vh); opacity: var(--rune-opacity); visibility: visible; } /* Fade in before moving */
    100% { transform: translateY(120vh); opacity: var(--rune-opacity); visibility: visible; }
}

/* Rune element styling */
.rune {
    position: absolute;
    color: #4B0082; /* Dark purple/indigo */
    text-shadow: 0 0 8px rgba(75, 0, 130, 0.2);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    pointer-events: none;
    animation: runeRain linear infinite;
    opacity: 0; /* Start completely invisible */
    visibility: hidden; /* Hide completely until animation starts */
    transition: text-shadow 0.5s ease, color 0.5s ease;
}

/* Rune pulse animation */
.rune-pulse {
    animation-name: runePulse, runeRain;
    animation-duration: 2s, linear;
    animation-timing-function: ease, linear;
    animation-iteration-count: 1, infinite;
    color: var(--light-purple) !important;
    text-shadow: 0 0 15px var(--light-purple), 0 0 25px var(--light-purple) !important;
    z-index: 2;
}

@keyframes runePulse {
    0% { text-shadow: 0 0 8px rgba(75, 0, 130, 0.2); }
    50% { text-shadow: 0 0 15px var(--purple), 0 0 25px var(--purple); }
    100% { text-shadow: 0 0 8px rgba(75, 0, 130, 0.2); }
}

.circuit-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.15;
    background-image: radial-gradient(rgba(85, 0, 189, 0.4) 1px, transparent 1px),
                      radial-gradient(rgba(85, 0, 189, 0.3) 1px, transparent 1px);
    background-size: 30px 30px;
    background-position: 0 0, 15px 15px;
}

.pulse-circles {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.pulse-circle {
    position: absolute;
    border: 1px solid rgba(85, 0, 189, 0.3);
    border-radius: 50%;
    opacity: 0;
    animation: pulse 6s infinite;
}

.pulse-circle:nth-child(1) {
    width: 100px;
    height: 100px;
    top: 20%;
    left: 30%;
    animation-delay: 0s;
}

.pulse-circle:nth-child(2) {
    width: 200px;
    height: 200px;
    top: 70%;
    left: 70%;
    animation-delay: 2s;
}

.pulse-circle:nth-child(3) {
    width: 150px;
    height: 150px;
    top: 40%;
    left: 80%;
    animation-delay: 4s;
}

@keyframes rain {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

/* Ensure body doesn't grow with animations */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

@keyframes pulse {
    0% { transform: scale(0.1); opacity: 0; }
    50% { opacity: 0.3; }
    100% { transform: scale(3); opacity: 0; }
}

/* Noise texture overlay */
.noise {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 10;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 0%, rgba(0, 0, 0, 0.7) 100%);
    pointer-events: none;
    z-index: 5;
}

/* Header and navigation */
header {
    padding: 2rem;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 100;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 50%, rgba(0, 0, 0, 0) 100%);
}

nav ul {
    display: flex;
    justify-content: flex-end;
    list-style: none;
    gap: 2rem;
    margin-right: 2rem;
}

nav a {
    text-decoration: none;
    font-family: 'Cinzel Decorative', serif;
    font-size: 0.95rem;
    letter-spacing: 1.2px;
    position: relative;
    padding: 0.3rem 0.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #6a0dad, #4B0082, #800080, #9370DB);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 2px rgba(147, 88, 182, 0.4);
}

/* Removed standalone hover effect, will integrate with glitch */

/* Glitch effect on nav items */
.glitch-effect {
    position: relative;
    display: inline-block;
}

.glitch-effect:hover {
    animation: linkColorChange 1s forwards;
}

@keyframes linkColorChange {
    0%, 30% { color: var(--purple); text-shadow: 0 0 5px var(--purple); }
    31%, 100% { color: #ff0000; text-shadow: 0 0 5px rgba(255, 0, 0, 0.5); }
}

.glitch-effect:hover::before,
.glitch-effect:hover::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.8;
}

.glitch-effect:hover::before {
    color: var(--purple);
    animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both,
               fadeOut 0.1s forwards;
    animation-delay: 0.1s, 0.5s;
    animation-iteration-count: 3, 1;
}

.glitch-effect:hover::after {
    color: var(--deep-purple);
    animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) reverse both,
               fadeOut 0.1s forwards;
    animation-delay: 0.2s, 0.5s;
    animation-iteration-count: 3, 1;
}

@keyframes fadeOut {
    0% { opacity: 0.8; }
    100% { opacity: 0; }
}

/* Main content */
main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

/* Sigil styles */
.sigil-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 4rem;
    margin: 2rem 0;
}

.sigil {
    width: 150px;
    height: 150px;
    position: relative;
    opacity: 0.85;
    transition: all 0.8s ease;
}

.sigil:hover {
    opacity: 1;
    transform: scale(1.05);
}

.animated-sigil {
    width: 100%;
    height: 100%;
    animation: rotate 20s linear infinite;
}

.sigil-1 .animated-sigil {
    animation-direction: normal;
}

.sigil-2 .animated-sigil {
    animation-direction: reverse;
    animation-duration: 25s;
}

.sigil-3 .animated-sigil {
    animation-direction: alternate;
    animation-duration: 30s;
}

.sigil-1:hover .animated-sigil path,
.sigil-1:hover .animated-sigil circle {
    stroke: var(--white);
    filter: drop-shadow(0 0 3px var(--white));
    stroke-width: 0.7;
}

.sigil-2:hover .animated-sigil path,
.sigil-2:hover .animated-sigil polygon {
    stroke: var(--red);
    filter: drop-shadow(0 0 3px var(--red));
    stroke-width: 0.7;
}

.sigil-3:hover .animated-sigil path {
    stroke: var(--purple);
    filter: drop-shadow(0 0 3px var(--purple));
    stroke-width: 0.7;
}

/* Rune Circle */
.rune-circle {
    position: fixed;
    width: min(110vh, 800px);
    height: min(110vh, 800px);
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5; /* Further increased z-index */
    pointer-events: none; /* Allow interaction with elements behind */
    visibility: visible !important; /* Force visibility */
    opacity: 1 !important; /* Force opacity */
}

.rune-circle::before {
    content: '';
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    border: 3px solid rgba(147, 88, 182, 0.4);
    border-radius: 50%;
    animation: pulse-border-purple 4s infinite alternate ease-in-out;
}

.rune-circle::after {
    content: '';
    position: absolute;
    top: -40px;
    left: -40px;
    right: -40px;
    bottom: -40px;
    border: 2px solid rgba(192, 70, 70, 0.4);
    border-radius: 50%;
    animation: pulse-border-red 5s infinite alternate-reverse ease-in-out;
}

.rune-container {
    position: relative;
    width: 100%;
    height: 100%;
    animation: slow-rotate 60s linear infinite;
    display: block !important; /* Force display */
    visibility: visible !important;
    opacity: 1 !important;
}

/* Specific styling for runes in the circle - explicitly override the base .rune class */
.circle-rune,
.rune-container .central-rune {
    position: absolute;
    font-size: 1.5rem;
    color: var(--light-gray);
    opacity: 0.8 !important; /* Force opacity to override base rule */
    visibility: visible !important; /* Force visibility to override base rule */
    text-shadow: 0 0 5px rgba(147, 88, 182, 0.8); /* Added glow effect */
    transition: all 0.3s ease;
    cursor: pointer;
    pointer-events: auto; /* Enable interactions */
}

.rune:nth-child(1) { top: 5%; left: 50%; transform: translateX(-50%); }
.rune:nth-child(2) { top: 10%; right: 20%; }
.rune:nth-child(3) { top: 25%; right: 10%; }
.rune:nth-child(4) { top: 50%; right: 5%; transform: translateY(-50%); }
.rune:nth-child(5) { bottom: 25%; right: 10%; }
.rune:nth-child(6) { bottom: 10%; right: 20%; }
.rune:nth-child(7) { bottom: 5%; left: 50%; transform: translateX(-50%); }
.rune:nth-child(8) { bottom: 10%; left: 20%; }
.rune:nth-child(9) { bottom: 25%; left: 10%; }
.rune:nth-child(10) { top: 50%; left: 5%; transform: translateY(-50%); }
.rune:nth-child(11) { top: 25%; left: 10%; }
.rune:nth-child(12) { top: 10%; left: 20%; }

/* Center rune styling */
.central-rune {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem; /* Larger size */
    color: var(--light-gray);
    opacity: 0.9; /* Higher opacity */
    transition: all 0.3s ease;
    animation: pulse-central-rune 3s infinite alternate;
    cursor: pointer;
    z-index: 2; /* Increased z-index */
    text-shadow: 0 0 8px rgba(147, 88, 182, 0.9), 0 0 15px rgba(192, 70, 70, 0.5); /* Enhanced glow */
}

.central-rune::before {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(192, 70, 70, 0.4);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse-strong 3s ease-in-out infinite;
    z-index: -1;
}

.rune:hover,
.central-rune:hover {
    color: var(--white);
    text-shadow: 0 0 10px var(--white), 0 0 20px var(--purple);
    opacity: 1;
}

.central-rune:hover {
    text-shadow: 0 0 15px var(--red), 0 0 25px var(--dark-red);
    transform: translate(-50%, -50%) scale(1.1);
}

/* Rune text */
.rune-text {
    position: absolute;
    font-family: 'Cinzel Decorative', serif;
    font-size: 4rem;
    color: var(--white);
    opacity: 0.1;
    z-index: -1;
    text-shadow: 0 0 30px var(--purple);
    letter-spacing: 5px;
    animation: subtle-pulse 5s ease-in-out infinite alternate;
}

/* Latin Text */
.latin-text {
    text-align: center;
    margin: -50px auto 0;
    position: relative;
    z-index: 2;
}

/* Text decode animation states */
.decoding, .encoding {
    position: relative;
}

.elder-futhark.decoded {
    font-family: 'Cinzel Decorative', serif;
    font-size: 4.0rem;
    font-weight: 700;
    letter-spacing: 7px;
    background: linear-gradient(135deg, #6a0dad, #4B0082, #800080, #9370DB);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 15px rgba(147, 88, 182, 0.4);
}

/* Hide original rune white outline when decoded */
.elder-futhark.decoded::before,
.elder-futhark.decoding::before,
.elder-futhark.encoding::before {
    display: none;
}

.elder-futhark {
    font-family: 'Cinzel Decorative', serif;
    font-size: 3.46rem;
    font-weight: 700;
    letter-spacing: 7px;
    margin: 0;
    cursor: pointer;
    transition: text-shadow 0.3s;
    line-height: 1.4;
    background: linear-gradient(135deg, #6a0dad, #4B0082, #800080, #9370DB);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    position: relative;
    display: inline-block;
    filter: drop-shadow(0 0 10px rgba(106, 13, 173, 0.8));
    z-index: 5;
    -webkit-text-stroke: 0.5px rgba(255, 255, 255, 0.3);
}

.elder-futhark::before {
    content: attr(data-text);
    position: absolute;
    left: -1px;
    top: -1px;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ffffff, #c0c0c0, #707070);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.25);
    text-shadow: 0 0 3px rgba(255, 255, 255, 0.5),
                0 0 5px rgba(255, 255, 255, 0.3);
    z-index: -1;
    opacity: 0.7;
    filter: blur(0.5px);
}

.ea-advenit {
    font-family: 'Cinzel Decorative', serif;
    font-size: 1.9rem; /* Additional 10% reduction */
    font-weight: 400;
    letter-spacing: 4px;
    color: var(--white);
    opacity: 0.75;
    cursor: pointer;
    margin: 0;
    text-shadow: 0 0 15px rgba(147, 88, 182, 0.4);
    line-height: 1.3;
}

/* Countdown Section */
.countdown {
    margin: 100px auto 0;
    width: 100%;
    max-width: 600px;
    position: relative;
    z-index: 2;
}

.countdown-container {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    padding: 1rem 0;
    border-top: 3px solid;
    border-bottom: 3px solid;
    border-left: 0;
    border-right: 0;
    border-image: linear-gradient(to right, #4B0000, #8B0000, #4B0000) 1;
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 10px rgba(139, 0, 0, 0.5);
}

.countdown-unit {
    display: flex;
    align-items: center;
    min-width: 45px;
}

.countdown-unit span {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    text-align: center;
}

.countdown-unit .count-days,
.countdown-unit .count-hours,
.countdown-unit .count-minutes,
.countdown-unit .count-seconds {
    font-size: 2.2rem;
    background: linear-gradient(to right, #8B0000, #FF0000, #8B0000);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    filter: drop-shadow(0 0 5px rgba(139, 0, 0, 0.7));
    font-weight: 400;
    font-family: 'Cinzel', serif;
}

/* Footer */
footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    padding: 1rem 2rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
    z-index: 100;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.8em;
    font-family: 'Cormorant Garamond', serif;
    color: var(--light-gray);
    opacity: 0.5;
    letter-spacing: 1px;
}

.footer-content p {
    margin: 0.2rem 1rem 0.2rem 0;
}

/* Set the timestamp (Access time) to have a higher opacity */
.timestamp {
    opacity: 0.5;
}

.random-hash {
    font-size: 0.9em;
    letter-spacing: 1px;
}

/* Animations */
@keyframes glitch {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
    100% {
        transform: translate(0);
    }
}

@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes slow-rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse-border-purple {
    0% {
        box-shadow: 0 0 0 0 rgba(147, 88, 182, 0.1);
        opacity: 0.3;
    }
    50% {
        box-shadow: 0 0 10px 5px rgba(147, 88, 182, 0.4);
        opacity: 0.7;
    }
    100% {
        box-shadow: 0 0 0 15px rgba(147, 88, 182, 0);
        opacity: 0.3;
    }
}

@keyframes pulse-border-red {
    0% {
        box-shadow: 0 0 0 0 rgba(192, 70, 70, 0.1);
        opacity: 0.3;
    }
    50% {
        box-shadow: 0 0 10px 5px rgba(192, 70, 70, 0.4);
        opacity: 0.7;
    }
    100% {
        box-shadow: 0 0 0 15px rgba(192, 70, 70, 0);
        opacity: 0.3;
    }
}

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

@keyframes subtle-pulse {
    0% {
        opacity: 0.08;
        transform: scale(0.98);
    }
    100% {
        opacity: 0.15;
        transform: scale(1);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .sigil-container {
        gap: 2rem;
    }
    
    .sigil {
        width: 120px;
        height: 120px;
    }
    
    .rune-circle {
        width: 250px;
        height: 250px;
    }
    
    .footer-content {
        justify-content: center;
        text-align: center;
    }
    
    /* Hide Node and Access information on small screens */
    .timestamp, .code {
        display: none;
    }
    
    nav ul {
        justify-content: center;
        margin-right: 0;
    }
}

/* Fade-in animation */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

main {
    animation: fadeIn 1.5s ease-in-out;
}

@keyframes textGlow {
    0% {
        text-shadow: 0 0 10px rgba(192, 70, 70, 0.3);
    }
    50% {
        text-shadow: 0 0 15px rgba(192, 70, 70, 0.5), 0 0 20px rgba(147, 88, 182, 0.3);
    }
    100% {
        text-shadow: 0 0 10px rgba(192, 70, 70, 0.3);
    }
}
