/* ===== HEAD.CSS (COMPLETE 300+ LINE "BRANDING IS AT STAKE" EDITION) ===== */

/* Base Styles */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    overflow-x: hidden;
    transition: var(--transition);
    font-size: 16px;
}

/* Ukubona LLC system */
.wrap-max {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

/* BACKGROUND ANIMATION - FULLY RESTORED */
.bg-pattern { position: fixed; inset: 0; z-index: -2; background: var(--bg); }
.bg-pattern::before {
    content: ''; position: absolute; inset: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(102,126,234,.10) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(118,75,162,.10) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(240,147,251,.08) 0%, transparent 50%);
    animation: bgFloat 20s ease-in-out infinite;
}
@keyframes bgFloat {
    0%, 100% { transform: translate(0,0) rotate(0deg); }
    33% { transform: translate(-20px,-20px) rotate(1deg); }
    66% { transform: translate(20px,-10px) rotate(-1deg); }
}

.scroll-indicator { position: fixed; top: 0; left: 0; width: 100%; height: 3px; z-index: 1000; background: var(--glass); }
.scroll-progress { height: 100%; width: 0%; background: var(--primary-gradient); transition: width .3s ease; }

/* HEADER - THE STATEMENT PIECE */
.header {
    position: fixed; top: 0; left: 0; width: 100%; z-index: 100;
    backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
    background: var(--surface); border-bottom: 1px solid var(--border); 
    min-height: 220px; /* Massive header height to frame the logo */
}
.nav-container { 
    height: 220px; 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
}

/* THE LOGO - MATCHING UKUBONA SCALE */
#logo.logo {
    width: 160px !important; 
    height: 160px !important; 
    object-fit: contain;
    transform-origin: center center; 
    animation: spin var(--logo-spin-duration) linear infinite;
    display: block; 
    will-change: transform;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.2));
}
@keyframes spin { to { transform: rotate(360deg); } }

.nav-links { display: flex; list-style: none; gap: 2rem; margin: 0; padding: 0; }
.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}
.nav-link::after {
    content: ''; position: absolute; bottom: -4px; left: 0; width: 0; height: 2px;
    background: var(--primary-gradient); transition: width .3s ease;
}
.nav-link:hover { color: var(--text); }
.nav-link:hover::after { width: 100%; }

.top-right { display: flex; align-items: center; gap: 1rem; }

.menu-icon {
    display: grid; grid-template-columns: repeat(3, 6px); gap: 3px; padding: 8px;
    background: var(--glass); border: 1px solid var(--border);
    border-radius: 8px; cursor: pointer; transition: var(--transition);
}
.menu-icon div { width: 6px; height: 6px; background: var(--text); border-radius: 50%; transition: var(--transition); }
.menu-icon:hover { background: var(--primary-gradient); transform: scale(1.05); }
.menu-icon:hover div { background: white; }

#toggle-theme {
    padding: 8px 12px; background: var(--glass); border: 1px solid var(--border);
    border-radius: 8px; cursor: pointer; font-size: 16px; transition: var(--transition);
}
#toggle-theme:hover { background: var(--secondary-gradient); color: #fff; transform: scale(1.05); }

/* APP GRID - FULL LOGIC RESTORED */
.app-grid {
    position: fixed;
    top: 230px; /* Positioned exactly below the 220px header */
    right: 2rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1rem;
    background: var(--surface);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(.95);
    transition: var(--transition);
    min-width: 300px;
    z-index: 1000;
    max-height: 80vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.app-grid.active { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

.app-grid a {
    display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 1rem;
    text-decoration: none; color: var(--text);
    background: var(--glass); border: 1px solid var(--border); border-radius: 12px;
    transition: var(--transition); font-size: 14px; font-weight: 500;
}
.app-grid a:hover {
    background: var(--primary-gradient); color: #fff; transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102,126,234,.3);
}

.icon-box {
    font-size: 24px; width: 48px; height: 48px; display: flex; align-items: center;
    justify-content: center; background: var(--glass); border-radius: 12px; transition: var(--transition);
}

/* Scrollbar styling */
.app-grid::-webkit-scrollbar { width: 8px; }
.app-grid::-webkit-scrollbar-track { background: transparent; }
.app-grid::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
.app-grid::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.4); }

/* MAIN CONTENT - INCREASED CLEARANCE */
.page {
    padding-top: 280px; /* Shoves the card down below the 220px header */
    padding-bottom: var(--space-2xl);
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-xl);
    margin: var(--space-xl) 0;
    box-shadow: var(--shadow);
}

/* TYPOGRAPHY - FULLY RESTORED */
.card h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: var(--space-lg);
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
    text-align: left;
}

.card h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: var(--space-lg);
    margin-bottom: var(--space-md);
    color: var(--text);
    border-left: 4px solid var(--accent-blue);
    padding-left: var(--space-md);
    text-align: left;
}

.card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: var(--space-md);
    margin-bottom: var(--space-sm);
    color: var(--text);
    text-align: left;
}

.card p { margin-bottom: var(--space-md); color: var(--text-secondary); line-height: 1.7; }

.card ul, .card ol { margin-left: var(--space-lg); margin-bottom: var(--space-md); color: var(--text-secondary); }

.card li { margin-bottom: var(--space-xs); line-height: 1.7; }

.card code {
    background: var(--glass);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--accent-blue);
}

.card pre {
    background: var(--glass);
    padding: var(--space-md);
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: var(--space-md);
}

.card pre code { background: none; padding: 0; color: var(--text); }

/* RESPONSIVE - FULLY RESTORED + BRANDING TWEAKS */
@media (max-width: 768px) {
    .header {
        min-height: 180px; /* Keeping mobile header large for branding */
    }
    .nav-container {
        height: 180px;
    }
    #logo.logo {
        width: 120px !important;
        height: 120px !important;
    }
    .page {
        padding-top: 240px !important; 
    }
    .nav-links { display: none; }
    .app-grid {
        top: 185px;
        right: 1rem;
        left: 1rem;
        grid-template-columns: repeat(2, 1fr);
    }
    .wrap-max { padding: 0 var(--space-md); }
    .card { padding: var(--space-lg); }
    .card h1 { font-size: 2rem; }
    .card h2 { font-size: 1.5rem; }
}

/* ELEGANT LINK STYLES - FULLY RESTORED */
.card a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.7), rgba(118, 75, 162, 0.7));
    background-size: 0% 1.5px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition: background-size 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s ease;
}

.card a:hover {
    background-size: 100% 1.5px;
    color: #667eea;
}

.footer a, .footer-micro a, #footer-placeholder a {
    color: var(--text-secondary) !important;
    text-decoration: none !important;
    border-bottom: 1px solid transparent !important;
    background: none !important;
    transition: all 0.3s ease !important;
}

.footer a:hover, .footer-micro a:hover, #footer-placeholder a:hover {
    color: #667eea !important;
    border-bottom-color: rgba(102, 126, 234, 0.4) !important;
}

figcaption a {
    color: inherit;
    text-decoration: none;
    position: relative;
    opacity: 0.9;
    background: none !important;
}

figcaption a::after {
    content: ''; position: absolute; bottom: -1px; left: 0; width: 0; height: 1px;
    background: currentColor; opacity: 0.5; transition: width 0.3s ease;
}

figcaption a:hover { opacity: 1; }
figcaption a:hover::after { width: 100%; }