/* ============================================================
   SHARED STYLES – Nhlanhla Macdonald Zondi Portfolio
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700;800&display=swap');

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

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden;
    transition: all 0.3s ease;
    min-height: 100vh;
}

/* ─── Futuristic Canvas Background ─── */
.city-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background: #02020f;
    /* deep-space base — canvas draws all the motion */
}

/* Dark overlay for readability */
.city-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: rgba(10, 10, 30, 0.58);
}

/* Light Mode */
body.light-mode .city-overlay {
    background: rgba(230, 235, 255, 0.45);
}

/* ─── Theme Variables ─── */
body.light-mode {
    --text-primary: #1e293b;
    --text-secondary: #374151;
    --card-bg: rgba(255, 255, 255, 0.82);
    --card-border: rgba(102, 126, 234, 0.25);
    --nav-bg: rgba(255, 255, 255, 0.88);
    --shadow-color: rgba(0, 0, 0, 0.15);
}

body.dark-mode {
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --card-bg: rgba(15, 23, 42, 0.80);
    --card-border: rgba(139, 92, 246, 0.25);
    --nav-bg: rgba(15, 23, 42, 0.90);
    --shadow-color: rgba(0, 0, 0, 0.5);
}

/* ─── Navigation ─── */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--nav-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 14px 0;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 0 16px;
}

nav a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s;
    letter-spacing: 0.3px;
}

nav a:hover,
nav a.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.45);
}

/* Theme Toggle */
.theme-toggle {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.theme-toggle:hover {
    transform: scale(1.06);
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.5);
}

/* ─── Page Wrapper ─── */
.page-wrapper {
    min-height: 100vh;
    padding-top: 80px;
    padding-bottom: 60px;
}

/* ─── Container ─── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ─── Glass Cards ─── */
section,
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px var(--shadow-color);
    animation: fadeInUp 0.6s ease both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Typography ─── */
h2 {
    color: #818cf8;
    margin-bottom: 22px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.4);
    font-size: 2em;
    font-weight: 700;
    letter-spacing: -0.5px;
}

h3 {
    color: var(--text-primary);
    margin-top: 22px;
    margin-bottom: 10px;
    font-weight: 600;
}

p {
    line-height: 1.85;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

ul {
    color: var(--text-secondary);
}

/* ─── Skills Grid ─── */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 14px;
    margin-top: 20px;
}

.skill-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 18px;
    border-radius: 12px;
    text-align: center;
    font-weight: 700;
    font-size: 0.9em;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: default;
}

.skill-item:hover {
    transform: translateY(-6px) scale(1.04);
    box-shadow: 0 10px 28px rgba(102, 126, 234, 0.5);
}

/* ─── Projects Grid ─── */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 24px;
    margin-top: 20px;
}

.project-card {
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 26px;
    transition: all 0.3s;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
}

.project-card:hover {
    border-color: #667eea;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.35);
    transform: translateY(-6px);
}

.project-card h3 {
    color: #818cf8;
    font-size: 1.4em;
    margin-bottom: 14px;
    margin-top: 0;
}

.project-link {
    display: inline-block;
    margin-top: 16px;
    color: #818cf8;
    text-decoration: none;
    font-weight: 700;
    padding: 9px 20px;
    border: 2px solid #818cf8;
    border-radius: 25px;
    font-size: 0.9em;
    transition: all 0.3s;
}

.project-link:hover {
    background: #667eea;
    border-color: #667eea;
    color: white;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.45);
}

/* ─── Connect Grid ─── */
.connect-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.connect-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 36px;
    border-radius: 16px;
    text-align: center;
    text-decoration: none;
    transition: transform 0.3s, box-shadow 0.3s;
    display: block;
}

.connect-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

.connect-card h3 {
    color: white;
    margin: 0 0 10px 0;
    font-size: 1.7em;
}

.connect-card p {
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

/* ─── CTA Button ─── */
.cta-button {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 42px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1em;
    margin-top: 22px;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.cta-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 14px 30px rgba(102, 126, 234, 0.5);
}

/* ─── Chat Interface ─── */
.chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    max-width: 90vw;
    z-index: 2000;
}

.chat-toggle {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 16px 28px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
    transition: transform 0.3s;
}

.chat-toggle:hover {
    transform: scale(1.06);
}

.chat-box {
    display: none;
    background: var(--card-bg);
    backdrop-filter: blur(18px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    box-shadow: 0 12px 45px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    margin-bottom: 15px;
}

.chat-box.active {
    display: block;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 18px 22px;
    font-weight: bold;
    font-size: 1.05em;
}

.chat-messages {
    height: 320px;
    overflow-y: auto;
    padding: 18px;
}

.message {
    margin-bottom: 14px;
    padding: 11px 16px;
    border-radius: 14px;
    max-width: 85%;
    font-size: 0.93em;
    line-height: 1.6;
    animation: msgSlide 0.3s ease;
}

@keyframes msgSlide {
    from {
        opacity: 0;
        transform: translateX(8px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.message.user {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    margin-left: auto;
}

.message.bot {
    background: rgba(100, 116, 139, 0.2);
    color: var(--text-primary);
}

.chat-input-container {
    display: flex;
    padding: 14px;
    border-top: 1px solid var(--card-border);
    gap: 10px;
}

.chat-input {
    flex: 1;
    border: 2px solid var(--card-border);
    border-radius: 25px;
    padding: 11px 17px;
    font-size: 14px;
    background: transparent;
    color: var(--text-primary);
    transition: border-color 0.3s;
}

.chat-input:focus {
    outline: none;
    border-color: #667eea;
}

.chat-send {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 11px 22px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    transition: opacity 0.3s;
}

.chat-send:hover {
    opacity: 0.88;
}

.typing-indicator {
    display: none;
    padding: 8px 18px;
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.85em;
}

/* ─── Floating city particles (pedestrians & cars overlay) ─── */
#cityCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    nav ul {
        gap: 4px;
        padding: 0 8px;
    }

    nav a {
        font-size: 0.82em;
        padding: 6px 10px;
    }

    section,
    .glass-card {
        padding: 26px 20px;
    }

    h2 {
        font-size: 1.6em;
    }
}