/* ===========================================
   PRIME - An AI-native operating system for the trades
   Stark, calm, confident design
   =========================================== */

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --text-primary: #e8e8e8;
    --text-secondary: #888888;
    --text-muted: #444444;
    --accent: #3d5a5a;
    --reveal-size: 200px;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    cursor: none;
    position: relative;
}

/* Custom Cursor */
.cursor {
    width: 4px;
    height: 4px;
    background: var(--text-primary);
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    transform: translate(-50%, -50%);
    transition: transform 0.1s ease, opacity 0.3s ease;
    mix-blend-mode: difference;
}

.cursor-follower {
    width: 32px;
    height: 32px;
    border: 1px solid var(--text-secondary);
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: transform 0.15s ease-out, opacity 0.3s ease;
    opacity: 0.5;
}

.cursor.hidden,
.cursor-follower.hidden {
    opacity: 0;
}

/* Brand */
.brand {
    position: fixed;
    top: 32px;
    left: 40px;
    z-index: 1000;
}

.brand-name {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.brand-name:hover {
    opacity: 1;
}

/* Navigation */
.nav {
    position: fixed;
    top: 32px;
    right: 40px;
    z-index: 1000;
}

.nav-link {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-secondary);
    cursor: none;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--text-primary);
}

/* Layer 2 - The Underneath */
.layer-2 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: var(--bg-secondary);
    overflow: hidden;
}

/* Animated Background - Always visible as base */
.animated-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 30%, rgba(40, 80, 80, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(30, 60, 90, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(20, 50, 70, 0.2) 0%, transparent 70%),
        linear-gradient(180deg, #0a1015 0%, #0d1520 50%, #081018 100%);
    animation: bgPulse 8s ease-in-out infinite;
}

@keyframes bgPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Grid overlay */
.animated-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(60, 100, 120, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(60, 100, 120, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* Floating particles effect */
.animated-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20% 30%, rgba(100, 180, 200, 0.4), transparent),
        radial-gradient(2px 2px at 40% 70%, rgba(100, 180, 200, 0.3), transparent),
        radial-gradient(1px 1px at 60% 20%, rgba(100, 180, 200, 0.4), transparent),
        radial-gradient(2px 2px at 80% 50%, rgba(100, 180, 200, 0.3), transparent),
        radial-gradient(1px 1px at 10% 80%, rgba(100, 180, 200, 0.4), transparent),
        radial-gradient(2px 2px at 70% 90%, rgba(100, 180, 200, 0.3), transparent),
        radial-gradient(1px 1px at 90% 10%, rgba(100, 180, 200, 0.4), transparent),
        radial-gradient(2px 2px at 30% 50%, rgba(100, 180, 200, 0.3), transparent);
    background-size: 100% 100%;
    animation: particleFloat 15s ease-in-out infinite;
}

@keyframes particleFloat {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.6; }
    50% { transform: translateY(-20px) scale(1.1); opacity: 0.9; }
}

.bg-images {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.bg-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
    filter: brightness(0.35) saturate(0.7) contrast(1.2) hue-rotate(-10deg);
}

.bg-img.active {
    opacity: 1;
}

/* System Log Fragments */
.system-logs {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.log-fragment {
    position: absolute;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    font-weight: 300;
    letter-spacing: 0.08em;
    color: rgba(120, 200, 200, 0.9);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    text-shadow: 0 0 30px rgba(80, 180, 180, 0.6), 0 0 60px rgba(80, 180, 180, 0.3);
    white-space: nowrap;
    background: rgba(0, 20, 30, 0.5);
    padding: 4px 8px;
    border-left: 2px solid rgba(80, 180, 180, 0.5);
}

.log-fragment.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Layer 1 - The Surface (Canvas mask) */
.layer-1 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
}

#reveal-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Content - Separate layer on top */
.content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    max-width: 800px;
    padding: 0 40px;
    z-index: 10;
    pointer-events: none;
}

.primary-text {
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 300;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 32px;
}

.secondary-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.75rem, 1.5vw, 0.875rem);
    font-weight: 300;
    line-height: 1.8;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    max-width: 520px;
    margin: 0 auto;
}

/* Layer 3 - Idle Message */
.layer-3 {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.layer-3.visible {
    opacity: 1;
}

.idle-message {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    text-align: center;
    padding: 16px 32px;
    background: rgba(10, 10, 10, 0.9);
    border: 1px solid var(--text-muted);
}

/* Footer */
.footer {
    position: fixed;
    bottom: 32px;
    left: 40px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.footer-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    font-weight: 300;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    opacity: 0.6;
}

/* Micro-copy */
.micro-copy {
    position: fixed;
    bottom: 32px;
    right: 40px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    font-weight: 300;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    opacity: 0.4;
    z-index: 1000;
}

/* Access Overlay - System-like access request */
.access-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease, background 0.4s ease;
    cursor: text;
}

.access-overlay.active {
    opacity: 1;
    visibility: visible;
    background: rgba(0, 0, 0, 0.92);
}

.access-container {
    text-align: center;
    max-width: 400px;
    width: 100%;
    padding: 0 40px;
}

.access-state {
    transition: opacity 0.3s ease;
}

.access-state.hidden {
    display: none;
}

.access-prompt {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.access-input-wrapper {
    position: relative;
}

.access-input {
    width: 100%;
    padding: 12px 0;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9rem;
    font-weight: 300;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--text-muted);
    outline: none;
    text-align: center;
    transition: border-color 0.3s ease;
    caret-color: var(--text-primary);
}

.access-input::placeholder {
    color: var(--text-muted);
    font-weight: 300;
    letter-spacing: 0.08em;
}

.access-input:focus {
    border-color: var(--text-secondary);
}

.access-feedback {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

/* Thin caret cursor style */
.access-overlay.active {
    cursor: text;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        cursor: auto;
    }
    
    .cursor,
    .cursor-follower {
        display: none;
    }
    
    .brand {
        top: 24px;
        left: 24px;
    }
    
    .nav {
        top: 24px;
        right: 24px;
    }
    
    .footer {
        bottom: 24px;
        left: 24px;
    }
    
    .micro-copy {
        bottom: 24px;
        right: 24px;
    }
    
    .content {
        padding: 0 24px;
    }
    
    .primary-text {
        margin-bottom: 24px;
    }
    
    .log-fragment {
        font-size: 0.6rem;
    }
    
    .access-container {
        padding: 0 24px;
    }
}

@media (max-width: 480px) {
    .footer {
        display: none;
    }
    
    .micro-copy {
        left: 24px;
        right: 24px;
        text-align: center;
    }
}

/* Preloader fade out */
body.loaded .layer-1 {
    transition: none;
}

/* Smooth performance */
.layer-1,
.layer-2,
#reveal-mask {
    will-change: transform;
    backface-visibility: hidden;
}
