/* --- 1. VARIABLES & RESET --- */

:root {
    /* Brand Colors (Constant) */
    --primary: #06b6d4;
    --secondary: #8b5cf6;
    --transition: all 0.3s ease-in-out;
    --header-height: 70px;
    --bottom-nav-height: 65px;
    /* DARK MODE COLORS (Default) */
    --bg-color: #0f172a;
    --text-color: #f1f5f9;
    --header-bg: rgba(15, 23, 42, 0.85);
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.1);
    --timeline-line: rgba(255, 255, 255, 0.1);
}


/* LIGHT MODE OVERRIDES - This fixes your whole page background */

body.light-mode {
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --header-bg: rgba(248, 250, 252, 0.85);
    --card-bg: #ffffff;
    --card-border: rgba(0, 0, 0, 0.08);
    --timeline-line: rgba(0, 0, 0, 0.1);
}

body.light-mode .timeline {
    border-left-color: rgba(0, 0, 0, 0.1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}


/* --- 2. HEADER (DESKTOP & COMMON) --- */

#main-header {
    position: fixed;
    top: 0;
    width: 100%;
    height: var(--header-height);
    z-index: 1000;
    backdrop-filter: blur(12px);
    /* Glassmorphism */
    -webkit-backdrop-filter: blur(12px);
    background-color: var(--header-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}


/* Brand Styling */

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    text-decoration: none;
    letter-spacing: 1px;
    font-family: 'Courier New', monospace;
    /* Engineering vibe */
}

.logo-primary {
    color: var(--primary);
}

.logo-secondary {
    color: var(--secondary);
}

.tagline-container {
    display: none;
    /* Hidden on small mobile */
    margin-left: 15px;
    font-size: 0.85rem;
    color: var(--text-color);
    opacity: 0.8;
    border-left: 2px solid var(--secondary);
    padding-left: 10px;
    width: 200px;
    /* Fixed width for typing stability */
}

@media (min-width: 768px) {
    .tagline-container {
        display: block;
    }
}


/* Desktop Navigation */

.desktop-nav ul {
    display: flex;
    gap: 30px;
    list-style: none;
}

.nav-link {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    transition: var(--transition);
}

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


/* Cyber Underline Effect */

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: var(--secondary);
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.external {
    display: flex;
    align-items: center;
    gap: 4px;
}


/* Theme Toggle */

#theme-toggle {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    color: var(--text-color);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

#theme-toggle:hover {
    background: var(--hover-bg);
    border-color: var(--primary);
    color: var(--primary);
    transform: rotate(15deg);
}


/* --- 3. MOBILE RESPONSIVENESS --- */

.desktop-nav {
    display: flex;
}

.mobile-bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    .desktop-nav {
        display: none;
    }
    /* Hide desktop menu */
    /* App-Like Bottom Nav */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: var(--bottom-nav-height);
        background-color: var(--header-bg);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        z-index: 1000;
        justify-content: space-around;
        align-items: center;
        padding-bottom: env(safe-area-inset-bottom);
        /* iOS safe area */
    }
    .mobile-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: var(--text-color);
        opacity: 0.6;
        font-size: 0.75rem;
        transition: var(--transition);
        width: 100%;
        height: 100%;
    }
    .mobile-link i {
        font-size: 1.4rem;
        margin-bottom: 4px;
    }
    /* Active State Animation for Mobile */
    .mobile-link.active {
        opacity: 1;
        color: var(--primary);
        transform: translateY(-5px);
    }
    .mobile-link.active i {
        color: var(--secondary);
    }
}


/* Footer Link */

.github-footer {
    text-align: center;
    margin-top: 60px;
    padding: 20px;
    border-radius: 15px;
    background: var(--hover-bg);
    display: inline-block;
    width: 100%;
}

.github-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    transition: 0.3s;
}

.github-footer a:hover {
    color: var(--secondary);
    letter-spacing: 0.5px;
}


/* Mobile Adjustments */

@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .project-card {
        padding: 20px;
    }
    .filter-btn {
        padding: 8px 18px;
        font-size: 0.8rem;
    }
}


/* --- FOOTER STYLES --- */

.main-footer {
    /* Uses a clean variable for background */
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--card-border);
    padding: 80px 20px 30px;
    margin-top: 50px;
    transition: background 0.3s ease, border-top 0.3s ease;
}


/* Day Mode specific footer background tweak if needed */

body.light-mode .main-footer {
    background: #fdfdfd;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 50px;
}


/* Logo & Branding */

.footer-logo {
    font-size: 1.8rem;
    font-weight: 900;
    text-decoration: none;
    letter-spacing: -1.5px;
    display: block;
}

.footer-logo .kaw {
    color: var(--primary);
}

.footer-logo .shik {
    color: var(--secondary);
}

.footer-tagline {
    margin-top: 15px;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color);
    opacity: 0.8;
}

.footer-motto {
    font-size: 0.85rem;
    opacity: 0.5;
    margin-top: 12px;
    font-style: italic;
    color: var(--text-color);
}


/* Headings */

.footer-heading {
    font-size: 0.9rem;
    color: var(--text-color);
    margin-bottom: 25px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 800;
}


/* Links List */

.footer-links {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.footer-links a {
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.95rem;
    opacity: 0.7;
    transition: all 0.3s ease;
    display: inline-block;
}

.footer-links a:hover {
    color: var(--primary);
    opacity: 1;
    transform: translateX(5px);
}

.blog-link {
    color: var(--secondary) !important;
    font-weight: 700 !important;
}


/* Social & Contact */

.footer-contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    cursor: pointer;
    margin-bottom: 20px;
    opacity: 0.8;
    position: relative;
    transition: 0.3s;
    color: var(--text-color);
}

.footer-contact-item:hover {
    color: var(--primary);
    opacity: 1;
}

.footer-copy-toast {
    position: absolute;
    top: -30px;
    left: 20px;
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 6px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.footer-contact-item.copied .footer-copy-toast {
    opacity: 1;
    transform: translateY(0);
}

.footer-social-icons {
    display: flex;
    gap: 18px;
    margin-top: 10px;
}

.footer-social-icons a {
    font-size: 1.5rem;
    color: var(--text-color);
    opacity: 0.6;
    transition: all 0.3s ease;
}

.footer-social-icons a:hover {
    color: var(--secondary);
    opacity: 1;
    transform: translateY(-5px);
}


/* Bottom Bar */

.footer-divider {
    border: none;
    border-top: 1px solid var(--card-border);
    margin-bottom: 30px;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.copyright {
    font-size: 0.85rem;
    opacity: 0.6;
    color: var(--text-color);
    font-weight: 500;
}


/* Scroll Top Button - Enhanced */

.scroll-top {
    background: var(--hover-bg);
    border: 1px solid var(--card-border);
    color: var(--text-color);
    width: 45px;
    height: 45px;
    border-radius: 12px;
    /* Square-ish modern look */
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.scroll-top:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(6, 182, 212, 0.3);
}


/* Mobile Responsiveness */

@media (max-width: 768px) {
    .main-footer {
        padding: 60px 20px 30px;
        text-align: center;
    }
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 40px;
        margin-bottom: 40px;
    }
    .footer-links {
        justify-content: center;
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        max-width: auto;
        margin: 0 auto;
    }
    .footer-contact-item {
        justify-content: center;
    }
    .footer-social-icons {
        justify-content: center;
    }
    .footer-bottom {
        flex-direction: column-reverse;
        gap: 25px;
    }
}

.footer-legal-links {
    display: inline-flex;
    gap: 10px;
    margin-left: 10px;
    list-style: none;
    padding: 0;
}

.footer-legal-links li {
    display: inline;
}

.footer-legal-links li:not(:last-child)::after {
    content: "|";
    margin-left: 10px;
    color: var(--text-secondary, #94a3b8);
}

.footer-legal-links a {
    text-decoration: none;
    color: inherit;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.footer-legal-links a:hover {
    color: #38bdf8;
    /* Adjust to your brand primary color */
}

@media (max-width: 768px) {
    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    .footer-legal-links {
        margin-left: 0;
        justify-content: center;
        flex-wrap: wrap;
    }
}


/* --- MODERN LEGAL STYLING --- */

.legal-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 40px;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.legal-header {
    text-align: center;
    margin-bottom: 60px;
}

.gradient-text {
    font-size: clamp(2.5rem, 8vw, 3.5rem);
    font-weight: 900;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 15px;
}

.last-updated {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(6, 182, 212, 0.1);
    color: var(--primary);
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.legal-section {
    margin-bottom: 40px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    border: 1px solid transparent;
    transition: var(--transition);
}

.legal-section:hover {
    border-color: var(--card-border);
    background: rgba(255, 255, 255, 0.04);
}

.legal-section h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-color);
    font-size: 1.4rem;
    margin-bottom: 15px;
}

.legal-section h2 i {
    color: var(--primary);
}

.legal-section p {
    color: var(--text-color);
    opacity: 0.8;
    line-height: 1.7;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.info-card {
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid var(--card-border);
    text-align: center;
}

.info-card i {
    font-size: 1.5rem;
    color: var(--secondary);
    margin-bottom: 10px;
    display: block;
}

.info-card strong {
    display: block;
    color: var(--primary);
    margin-bottom: 5px;
}


/* Light Mode Adjustments */

body.light-mode .legal-container {
    background: #ffffff;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
}

@media (max-width: 768px) {
    .legal-container {
        margin: 20px;
        padding: 25px;
    }
}