/* ========================================
   MALTHEN DESIGN SYSTEM - v4.0 (Atomic Cleanup)
   Strict Golden Ratio Architecture
   ======================================== */

:root {
    --phi: 1.61803398875;
    
    /* Spacing */
    --sp-1: 0.5rem;
    --sp-2: calc(var(--sp-1) * var(--phi)); 
    --sp-3: calc(var(--sp-2) * var(--phi)); 
    --sp-4: calc(var(--sp-3) * var(--phi)); 
    --sp-5: calc(var(--sp-4) * var(--phi)); 
    --sp-6: calc(var(--sp-5) * var(--phi)); 
    
    /* Colors */
    --black: #02040a;
    --white: #ffffff;
    --cyan: #5b9cff; /* Tech Blue */
    --purple: #ff5900; /* Aerospace Orange */
    --gold: #f2c94c;
    
    /* Typography */
    --font-main: 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --fs-xxl: 4.236rem;
    --fs-xl: 2.618rem;
    --fs-lg: 1.618rem;
    --fs-base: 1rem;
    --fs-sm: 0.75rem;
}

/* ---- Reset & Base ---- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { 
    background: var(--black) !important; 
    scroll-behavior: smooth; 
    color-scheme: dark;
}

body { 
    background: transparent !important;
    font-family: var(--font-main); 
    color: var(--white) !important;
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---- Layout Components ---- */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--sp-4);
}

section {
    position: relative;
    z-index: 10;
    padding: var(--sp-6) 0;
}

/* ---- Typography ---- */
h1 {
    font-size: clamp(2.5rem, 6vw, var(--fs-xxl)) !important;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.04em;
    margin-bottom: var(--sp-3);
    color: var(--white) !important;
}

h2 {
    font-size: clamp(1.8rem, 4vw, var(--fs-xl));
    font-weight: 700;
    margin-bottom: var(--sp-3);
}

.label-mono {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--cyan);
    letter-spacing: 0.35em;
    text-transform: uppercase;
    display: block;
    margin-bottom: var(--sp-2);
    opacity: 0.8;
}

/* ---- Navbar (Premium) ---- */
.nav-ethereal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; max-width: 100%;
    background: rgba(18, 25, 41, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-bottom: 1px solid rgba(91, 156, 255, 0.2);
    border-radius: 0;
    padding: var(--sp-2) var(--sp-6);
    display: flex; align-items: center; justify-content: space-between;
    z-index: 10000;
}

.nav-brand {
    display: flex; align-items: center; gap: var(--sp-3);
    text-decoration: none; color: var(--white);
}

.brand-symbol {
    position: relative;
    width: 42px; height: 42px;
    display: flex; align-items: center; justify-content: center;
}

.orbit-ring {
    position: absolute; inset: 0;
    border: 2px solid transparent;
    border-left-color: var(--cyan);
    border-top-color: var(--cyan);
    border-bottom-color: var(--purple);
    border-radius: 50%;
    animation: orbit-spin 15s linear infinite; /* Majestic slow rotation */
    filter: drop-shadow(0 0 8px rgba(0, 217, 255, 0.3));
}

.orbit-ring::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 2.5px;
    height: 7px;
    background: linear-gradient(to bottom, var(--cyan), var(--purple));
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(0, 217, 255, 0.5);
}

.brand-symbol .m { font-weight: 800; font-size: 1.2rem; }
.brand-wordmark { font-weight: 800; letter-spacing: 4px; font-size: 1rem; }

@keyframes orbit-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.nav-links { display: flex; gap: var(--sp-4); }
.nav-link-minimal {
    font-family: var(--font-mono); font-size: 0.65rem;
    color: var(--white); opacity: 0.5;
    text-decoration: none; text-transform: uppercase;
    letter-spacing: 2px; transition: 0.3s;
}
.nav-link-minimal:hover { opacity: 1; color: var(--cyan); }

/* ---- Buttons ---- */
.btn-phi {
    padding: 0.9rem 1.8rem;
    border-radius: 2px;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-decoration: none;
    transition: 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    display: inline-flex; align-items: center; justify-content: center;
}
.btn-primary { background: var(--white); color: var(--black); }
.btn-primary:hover { transform: scale(1.05); box-shadow: 0 0 30px rgba(255,255,255,0.2); }
.btn-outline { border: 1px solid rgba(255,255,255,0.2); color: var(--white); }
.btn-outline:hover { border-color: var(--white); background: rgba(255,255,255,0.05); }

/* ---- Bento Grid ---- */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--sp-4);
}

.card-phi {
    grid-column: span 4;
    background: rgba(18, 25, 41, 0.7); /* Brighter deep slate blue/grey */
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(91, 156, 255, 0.25); /* Tech blue subtle border */
    border-radius: 0;
    padding: var(--sp-4);
    transition: 0.5s;
    position: relative;
}
.card-phi::before {
    content: '';
    position: absolute;
    top: -1px; left: -1px; width: 10px; height: 10px;
    border-top: 2px solid var(--cyan);
    border-left: 2px solid var(--cyan);
}
.card-phi::after {
    content: '';
    position: absolute;
    bottom: -1px; right: -1px; width: 10px; height: 10px;
    border-bottom: 2px solid var(--cyan);
    border-right: 2px solid var(--cyan);
}

.card-phi:hover {
    background: rgba(25, 35, 58, 0.85); /* Slightly brighter hover state */
    border-color: rgba(91, 156, 255, 0.5);
    transform: translateY(-4px);
    box-shadow: 0 10px 35px rgba(91, 156, 255, 0.15);
}

.card-phi.span-8 { grid-column: span 8; }
.card-phi.span-12 { grid-column: span 12; }
.card-phi.span-6 { grid-column: span 6; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--black); }
::-webkit-scrollbar-thumb { 
    background: rgba(255, 255, 255, 0.1); 
    border-radius: 10px; 
}
::-webkit-scrollbar-thumb:hover { background: var(--cyan); }

/* ---- Hero Assets ---- */
#blackholeCanvas {
    position: absolute;
    top: 10%; right: 5%;
    width: 140px; height: 140px;
    z-index: 1;
    pointer-events: none;
    opacity: 0.6;
}

#bh-trigger {
    position: absolute;
    z-index: 100;
    cursor: pointer;
}

#starfield {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.9;
}

.classified-asset {
    position: absolute;
    top: 50%; left: 50%;
    width: 800px;
    z-index: 0;
    opacity: 0.05;
    pointer-events: none;
    mix-blend-mode: screen;
    filter: sepia(1) hue-rotate(180deg) brightness(1.2);
    transform: translate(-50%, -50%) rotate(-15deg);
}

#contact { position: relative; overflow: hidden; }

.hud-line {
    position: fixed;
    height: 1px;
    background: linear-gradient(90deg, var(--cyan), transparent);
    z-index: 99;
    pointer-events: none;
    opacity: 0;
    transform-origin: left center;
    transition: opacity 0.5s;
}

.hud-terminal {
    position: fixed;
    z-index: 100;
    pointer-events: none;
    transition: opacity 0.5s;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: var(--sp-2) var(--sp-3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    font-size: 0.6rem;
    white-space: nowrap;
}

.hud-terminal .telemetry {
    display: block;
    font-size: 0.5rem;
    opacity: 0.5;
    margin-top: 4px;
}

#hero { position: relative; }

.classified-asset img { width: 100%; height: auto; }
.asset-label { display: none; }

/* ---- Background Effects ---- */
.nebula-layer {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.35;
}

.nebula-layer.orion { background: radial-gradient(circle at 85% 15%, rgba(0, 217, 255, 0.18), transparent 60%); }
.nebula-layer.eagle { background: radial-gradient(circle at 15% 85%, rgba(122, 77, 255, 0.15), transparent 60%); }
.nebula-layer.lagoon { background: radial-gradient(circle at 50% 50%, rgba(255, 204, 102, 0.1), transparent 70%); }

/* ---- Terminal ---- */
.terminal-minimal {
    position: fixed;
    bottom: var(--sp-4);
    right: var(--sp-4);
    width: 320px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    z-index: 10001;
    font-family: var(--font-mono);
    overflow: hidden;
    transition: 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.terminal-header {
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.status-dot {
    width: 6px; height: 6px;
    background: #00ff00;
    border-radius: 50%;
    box-shadow: 0 0 10px #00ff00;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}

.terminal-title {
    font-size: 0.55rem;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 1px;
}

.terminal-body {
    height: 140px;
    padding: 12px;
    font-size: 0.65rem;
    overflow-y: auto;
    color: rgba(255, 255, 255, 0.7);
    scroll-behavior: smooth;
}

.terminal-body::-webkit-scrollbar { width: 2px; }

.terminal-input-wrapper {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.02);
}

.prompt { color: var(--cyan); font-weight: bold; }

#terminal-input {
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    width: 100%;
    font-family: var(--font-mono);
    font-size: 0.65rem;
}

.terminal-minimal:focus-within {
    border-color: var(--cyan);
    width: 380px;
}

.line { margin-bottom: 4px; line-height: 1.4; }
.line.cmd { color: var(--cyan); }
.line.res { color: var(--white); opacity: 0.9; }

/* ---- Responsive ---- */
@media (max-width: 991px) {
    .card-phi { grid-column: span 12 !important; }
    h1 { font-size: 2.5rem !important; }
    .nav-ethereal { width: 95%; }
}

/* MATRIX MODE */
.matrix-mode {
    filter: brightness(0.8) sepia(1) hue-rotate(80deg) saturate(3);
    background-color: #000 !important;
}
.matrix-mode * {
    text-shadow: 0 0 5px #00ff00;
}
.matrix-mode .terminal-window {
    border-color: #00ff00 !important;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5) !important;
}

/* ---- MALTHEN PREMIUM UI ADDITIONS ---- */
.nav-link-minimal {
    text-decoration: none;
    color: #fff;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 3px;
    opacity: 0.4;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    padding: 0.5rem 1rem;
}
.nav-link-minimal:hover { opacity: 1; transform: translateY(-2px); color: var(--cyan); }
.nav-link-minimal::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 1px;
    background: var(--cyan);
    transition: all 0.3s;
    transform: translateX(-50%);
}
.nav-link-minimal:hover::after { width: 30%; }

.btn-scanline {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: btn_scan 3s infinite;
}
@keyframes btn_scan {
    0% { left: -100%; }
    50% { left: 100%; }
    100% { left: 100%; }
}

/* Global Space Background Support for All Pages */
section, main, .page-container {
    background: transparent !important;
}

body {
    background-color: var(--black) !important;
}

/* ========================================
   HUD & COMMAND CENTER (NASA STYLE)
   ======================================== */
:root { --hud-main: var(--cyan); --hud-bg: rgba(18, 25, 41, 0.95); }
#malthen-command-center { position: fixed; bottom: 40px; right: 40px; z-index: 10000; font-family: 'JetBrains Mono', monospace; }

/* Gelişmiş Tetikleyici */
#command-trigger { 
    width: 65px; height: 65px; border-radius: 0; background: var(--hud-bg); border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--hud-main); cursor: pointer; position: relative; transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); overflow: hidden; padding: 0;
}
#command-trigger:hover { transform: translateY(-5px); border-color: var(--hud-main); box-shadow: 0 0 30px rgba(91, 156, 255, 0.2); }
.m-icon-inner { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; transition: all 0.5s; }
.m-letter { font-size: 22px; font-weight: 800; z-index: 2; }
.m-rings span { position: absolute; border: 1px solid var(--hud-main); border-radius: 0; opacity: 0.1; }
.m-rings span:nth-child(1) { width: 40px; height: 40px; }
.m-rings span:nth-child(2) { width: 55px; height: 55px; }

/* HUD Penceresi (Premium Black) */
.hud-window {
    position: absolute; bottom: 85px; right: 0; width: 420px; height: 550px;
    background: var(--hud-bg); border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 0;
    backdrop-filter: blur(25px); display: flex; flex-direction: column;
    opacity: 0; transform: scale(0.9) translateY(30px); pointer-events: none;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 30px 100px rgba(0,0,0,0.9); overflow: hidden;
}
#malthen-command-center.active .hud-window { opacity: 1; transform: scale(1) translateY(0); pointer-events: all; }

.hud-header { padding: 15px 25px; border-bottom: 1px solid rgba(255,255,255,0.05); display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,0.02); }
.hud-status { font-size: 9px; letter-spacing: 2px; color: var(--hud-main); display: flex; align-items: center; gap: 8px; font-weight: 700; text-transform: uppercase; }
.pulse-dot { width: 6px; height: 6px; background: var(--hud-main); border-radius: 0; animation: hud_pulse 2s infinite; }
@keyframes hud_pulse { 0% { opacity: 1; } 50% { opacity: 0.3; } 100% { opacity: 1; } }
.hud-title { font-size: 10px; opacity: 0.5; letter-spacing: 1px; }
#close-terminal { background: transparent; border: none; color: #fff; font-size: 20px; cursor: pointer; opacity: 0.3; transition: 0.3s; }
#close-terminal:hover { opacity: 1; color: var(--hud-main); }

.hud-body { flex-grow: 1; padding: 25px; overflow-y: auto; font-size: 11px; color: rgba(255,255,255,0.7); line-height: 1.8; }
.hud-log-item { margin-bottom: 10px; border-left: 1px solid rgba(255, 255, 255, 0.1); padding-left: 15px; animation: hud_fade_in 0.3s ease-out forwards; }
@keyframes hud_fade_in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }

.hud-input-area { padding: 20px 25px; background: rgba(0,0,0,0.5); border-top: 1px solid rgba(255,255,255,0.05); }
.input-line { display: flex; align-items: center; gap: 10px; }
.prompt { color: var(--hud-main); font-weight: 700; font-size: 10px; }
#global-cli-input { background: transparent; border: none; color: #fff; flex-grow: 1; outline: none; font-family: inherit; font-size: 11px; }
.cursor { width: 8px; height: 15px; background: var(--hud-main); animation: hud_blink 1s infinite; }
@keyframes hud_blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.hud-scanline { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%); background-size: 100% 4px; pointer-events: none; opacity: 0.1; }

@media (max-width: 576px) { .hud-window { width: 320px; height: 450px; right: -10px; } }

/* CUSTOM CONTEXT MENU (NASA STYLE) */
#malthen-context-menu {
    position: fixed;
    z-index: 20000;
    width: 150px;
    background: rgba(18, 25, 41, 0.95);
    border: 1px solid rgba(91, 156, 255, 0.25);
    backdrop-filter: blur(15px);
    border-radius: 0;
    padding: 5px 0;
    display: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.ctx-item {
    padding: 10px 20px;
    color: rgba(255,255,255,0.7);
    font-family: var(--font-mono);
    font-size: 11px;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.ctx-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--hud-main);
}

/* ---- Mobile Navigation (Bottom Tab Bar) ---- */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(10, 15, 25, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    z-index: 1000;
}
.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 10px;
    font-family: var(--font-primary);
    gap: 4px;
    transition: 0.3s;
    min-width: 44px; /* Touch target minimum */
    min-height: 44px;
    justify-content: center;
}
.mobile-nav-item i {
    font-size: 18px;
}
.mobile-nav-item:hover, .mobile-nav-item:focus {
    color: var(--cyan);
}

/* ---- Responsive Tweaks ---- */
@media (max-width: 768px) {
    .bento-grid {
        display: flex;
        flex-direction: column;
        gap: var(--sp-3);
    }
    .card-phi {
        grid-column: span 12 !important; /* Forces all bento items to full width on mobile */
        padding: var(--sp-3);
    }
    .section-padding {
        padding: 4rem 0; /* Smaller padding on mobile */
    }
    h1, .display-4 {
        font-size: 2.5rem !important; /* Scale down giant headers */
    }
    .hud-window {
        width: 90vw !important; /* Full width command center on mobile */
        height: 60vh !important;
        right: 5vw !important;
        bottom: 80px !important; /* Leave space for bottom nav */
    }
}

