/* 
   Premium Portfolio Styles
   Author: Ashley Mutangiri
*/

/* --- CSS Variables & Dark Mode (Option A) --- */
:root {
    /* Light Theme Colors */
    --bg-main: #fcfcfc;
    --bg-secondary: #f4f4f5;
    --bg-card: #ffffff;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --accent-color: #000000;
    --accent-hover: #374151;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-premium: 0 20px 40px -10px rgba(0,0,0,0.08);
    --nav-bg: rgba(255, 255, 255, 0.85);
    --input-bg: #f9fafb;
    --input-border: #d1d5db;
    --input-focus: #111827;
}

body:has(#theme-toggle:checked) {
    /* Dark Theme Colors */
    --bg-main: #0a0a0a;
    --bg-secondary: #121212;
    --bg-card: #1a1a1a;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --accent-color: #ffffff;
    --accent-hover: #e5e7eb;
    --border-color: #2d3748;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-premium: 0 20px 40px -10px rgba(0,0,0,0.5);
    --nav-bg: rgba(10, 10, 10, 0.85);
    --input-bg: #262626;
    --input-border: #404040;
    --input-focus: #ffffff;
}

/* --- Global Styles --- */
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Smooth Theme Transition */
body, .custom-navbar, .card, section, footer, .custom-input, .highlight-label, .custom-badge, .social-icon, .nav-link, .navbar-brand, h1, h2, h3, h4, h5, h6, p, span, div {
    transition-property: background-color, color, border-color, box-shadow;
    transition-duration: 0.5s;
    transition-timing-function: ease;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.text-muted-custom {
    color: var(--text-secondary) !important;
}

/* --- Accessibility --- */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent-color);
    color: var(--bg-main);
    padding: 8px;
    z-index: 10000;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
}

/* --- Theme Toggle Button --- */
.theme-toggle-label {
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, background-color 0.5s ease, border-color 0.5s ease;
}

.theme-toggle-label:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.theme-toggle-label i {
    position: absolute;
    font-size: 1.1rem;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.sun-icon {
    transform: translateY(30px) rotate(90deg);
    opacity: 0;
}

.moon-icon {
    transform: translateY(0) rotate(0);
    opacity: 1;
}

body:has(#theme-toggle:checked) .sun-icon {
    transform: translateY(0) rotate(0);
    opacity: 1;
}

body:has(#theme-toggle:checked) .moon-icon {
    transform: translateY(-30px) rotate(-90deg);
    opacity: 0;
}

/* --- Navigation --- */
.custom-navbar {
    background-color: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    transition: all 0.3s ease;
}

/* Force first navbar to always be dark mode */
#home .custom-navbar {
    --nav-bg: rgba(10, 10, 10, 0.85);
    --border-color: #2d3748;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --bg-secondary: #121212;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
}

section:not(#home) .custom-navbar {
    border-bottom: none;
}

.navbar-brand {
    color: var(--text-primary) !important;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}

.nav-link, .phone-link, .email-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    transition: color 0.2s ease;
    display: inline-block;
}

.nav-link {
    padding: 0.5rem 0 !important;
}

.phone-link, .email-link {
    padding: 0 !important;
}

.nav-link:hover, .nav-link:focus, .phone-link:hover, .phone-link:focus, .email-link:hover, .email-link:focus {
    color: var(--text-primary) !important;
}

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

.nav-link:hover::after, .nav-link:focus::after, .phone-link:hover::after, .phone-link:focus::after, .email-link:hover::after, .email-link:focus::after {
    width: 100%;
}

@media (max-width: 768px) {
    .nav-links {
        display: none !important; /* Hide on mobile to keep it clean without JS toggle */
    }
}

/* --- Hero Section --- */
.hero-section {
    min-height: 100vh;
    background-image: url('https://i.postimg.cc/tC9Dbzb7/3.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
    display: flex;
    flex-direction: column;
}

.hero-content {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.4), rgba(0,0,0,0.8));
    z-index: 0;
    backdrop-filter: grayscale(0%);
    -webkit-backdrop-filter: grayscale(0%);
    transition: backdrop-filter 1s ease, -webkit-backdrop-filter 1s ease;
}

body:has(#theme-toggle:checked) .hero-overlay {
    backdrop-filter: grayscale(100%);
    -webkit-backdrop-filter: grayscale(100%);
}

.hero-title {
    letter-spacing: -0.04em;
    text-shadow: 0 4px 12px rgba(0,0,0,0.3);
    color: #ffffff !important;
}

.hero-subtitle {
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-size: 1rem;
    opacity: 0.9;
    color: #ffffff !important;
}

/* --- Shared Components --- */
.highlight-label {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid var(--border-color);
}

.premium-card {
    background-color: var(--bg-card);
    border-radius: 24px;
    box-shadow: var(--shadow-premium);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Fix Bootstrap text colors in dark mode */
.card {
    --bs-card-bg: var(--bg-card);
    --bs-card-color: var(--text-primary);
    --bs-card-title-color: var(--text-primary);
}

.form-label, .form-control {
    color: var(--text-primary) !important;
}

/* --- About Section --- */
.about-section {
    background-color: var(--bg-secondary);
}

.print-bookmark {
    position: absolute;
    top: -18px;
    right: 30px;
    background-color: var(--text-primary);
    color: var(--bg-main);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: help;
}

.print-bookmark:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.profile-img {
    object-fit: cover;
    border: 4px solid var(--bg-card);
}

.custom-badge {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
}

/* --- Projects Section --- */
.projects-section {
    background-color: var(--bg-main);
}

.project-card {
    background-color: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    border: 1px solid var(--border-color) !important;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-premium);
}

.project-img {
    height: 240px;
    object-fit: cover;
    border-bottom: 1px solid var(--border-color);
}

/* Buttons */
.custom-btn {
    background-color: var(--accent-color);
    color: var(--bg-main);
    border: none;
    border-radius: 8px;
    font-weight: 500;
    padding: 0.6rem 1.2rem;
    transition: all 0.2s ease;
}

.custom-btn:hover, .custom-btn:focus {
    background-color: var(--accent-hover);
    color: var(--bg-main);
    transform: translateY(-1px);
}

.custom-btn-outline {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-btn-outline:hover, .custom-btn-outline:focus {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

/* --- Contact Section --- */
.contact-section {
    background-color: var(--bg-secondary);
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--bg-card);
    color: var(--text-primary);
    font-size: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    text-decoration: none;
    border: 1px solid var(--border-color);
}

.social-icon:hover, .social-icon:focus {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    color: var(--bg-main);
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

/* Forms */
.custom-input {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.custom-input:focus {
    background-color: var(--bg-card);
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.1);
    color: var(--text-primary);
    outline: none;
}

body:has(#theme-toggle:checked) .custom-input:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.custom-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* --- Contact Form Success Animation --- */
.success-state {
    background-color: var(--bg-card);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.success-content {
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s;
}

.success-icon {
    display: inline-block;
    transform: scale(0.5);
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.3s;
}

#contact-success:target {
    opacity: 1;
    visibility: visible;
}

#contact-success:target .success-content {
    transform: translateY(0);
    opacity: 1;
}

#contact-success:target .success-icon {
    transform: scale(1);
}

#contact-success:target ~ .contact-form {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.contact-form {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* --- Footer --- */
.footer-section {
    background-color: var(--bg-main);
    border-top: 1px solid var(--border-color);
}

/* --- Print Ready Resume --- */
@media print {
    body * {
        visibility: hidden;
    }
    #about, #about * {
        visibility: visible;
    }
    #about {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 0 !important;
        margin: 0 !important;
        background: white !important;
    }
    .premium-card {
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
    }
    .print-bookmark, .custom-navbar, .highlight-label {
        display: none !important;
    }
    body {
        background-color: white !important;
        color: black !important;
    }
    .text-muted-custom {
        color: #444 !important;
    }
    .custom-badge {
        border: 1px solid #ccc !important;
        color: #000 !important;
        background: transparent !important;
    }
    .profile-img {
        border: 2px solid #eee !important;
    }
}
