/* ==========================================================================
   Seward Mupereri Portfolio - Main Stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */
:root {
    --warm-cream: #F5F0E8;
    --near-black: #1C1C1A;
    --card-surface: #EDE8DF;
    --subtle-border: #DED9CF;
    --ink-dim: #7A756D;
    --brand-amber: #E57A1A;
    --midnight-base: #0a0a0a;
    --dark-card: #161616;
    --dark-border: rgba(255, 255, 255, 0.08);
    
    --font-sans: 'Inter', sans-serif;
    --font-serif: 'Playfair Display', Georgia, serif;
    --font-mono: 'JetBrains Mono', Courier New, monospace;
}

/* --------------------------------------------------------------------------
   Base Styles
   -------------------------------------------------------------------------- */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    font-family: var(--font-sans);
    background-color: var(--warm-cream);
    color: var(--near-black);
}

h1, h2, h3, h4, .serif-font {
    font-family: var(--font-serif);
}

.smooth-scroll {
    scroll-behavior: smooth;
}

/* --------------------------------------------------------------------------
   Image Hover Effects
   -------------------------------------------------------------------------- */
.img-container {
    overflow: hidden;
}

.img-container img {
    transition: transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    filter: grayscale(100%);
}

.img-container:hover img {
    transform: scale(1.05);
    filter: grayscale(0%);
}

/* --------------------------------------------------------------------------
   Custom Scrollbar
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--brand-black);
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--brand-amber);
}

/* --------------------------------------------------------------------------
   Selection Color
   -------------------------------------------------------------------------- */
::selection {
    background: var(--brand-amber);
    color: #ffffff;
}

/* --------------------------------------------------------------------------
   Hero Image Animations
   -------------------------------------------------------------------------- */
@keyframes slideInRight {
    0% {
        opacity: 0;
        transform: translateX(100px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes floatHero {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

.animate-slide-in-right {
    animation: slideInRight 0.8s ease-out forwards;
}

.animate-float {
    animation: floatHero 4s ease-in-out infinite;
}

/* Hero Image Wrapper with floating and mouse tracking */
.perspective-1000 {
    perspective: 1000px;
}

.hero-image-wrapper {
    transform-style: preserve-3d;
    will-change: transform, opacity;
}

.hero-image-wrapper.floating {
    animation: floatHero 3s ease-in-out infinite;
}

.hero-image-wrapper img {
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   Mobile Menu Styles
   -------------------------------------------------------------------------- */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 40;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 320px;
    height: 100vh;
    background-color: #F5F0E8 !important;
    border-left: 1px solid #DED9CF;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    overflow-y: auto;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
}

.mobile-menu.active {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #DED9CF;
    background-color: #F5F0E8;
}

.mobile-menu-header a {
    color: #1C1C1A !important;
}

.mobile-menu-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background: #EDE8DF;
    border: 1px solid #DED9CF;
    color: #1C1C1A;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-menu-close:hover {
    background: #E57A1A;
    color: #000;
    border-color: #E57A1A;
}

.mobile-menu-nav {
    padding: 2rem 1.5rem;
}

.mobile-menu-nav a {
    display: block;
    padding: 1rem 0;
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 600;
    color: #1C1C1A;
    border-bottom: 1px solid #DED9CF;
    transition: color 0.2s ease, padding-left 0.2s ease;
}

.mobile-menu-nav a:hover,
.mobile-menu-nav a.active {
    color: #E57A1A;
    padding-left: 0.5rem;
}

.mobile-menu-footer {
    padding: 1.5rem;
    border-top: 1px solid #DED9CF;
    margin-top: auto;
}

.mobile-menu-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1rem;
    background: #E57A1A;
    color: #000;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    border-radius: 0px;
    text-decoration: none;
    transition: background 0.2s ease;
}

.mobile-menu-cta:hover {
    background: #1C1C1A;
    color: #F5F0E8;
}

.mobile-menu-cta .pulse-dot {
    width: 8px;
    height: 8px;
    background: #000;
    border-radius: 50%;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Hamburger Button */
.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: #EDE8DF !important;
    border: 1px solid #DED9CF !important;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.hamburger:hover {
    border-color: #E57A1A !important;
}

.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background-color: #1C1C1A !important;
    transition: all 0.3s ease;
}

.hamburger span:nth-child(1) {
    margin-bottom: 5px;
}

.hamburger span:nth-child(2) {
    margin-bottom: 5px;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes slideUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes marquee {
    0% {
        transform: translateX(0%);
    }
    100% {
        transform: translateX(-100%);
    }
}

/* Animation utility classes */
.animate-blink {
    animation: blink 1s step-end infinite;
}

.animate-fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

.animate-slide-up {
    animation: slideUp 0.6s ease-out forwards;
}

.animate-marquee {
    animation: marquee 25s linear infinite;
}

.animate-pulse-slow {
    animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* --------------------------------------------------------------------------
   Responsive Utilities
   -------------------------------------------------------------------------- */

/* Prevent body scroll when mobile menu is open */
body.menu-open {
    overflow: hidden;
}

/* Better touch targets on mobile */
@media (max-width: 768px) {
    /* Smooth momentum scrolling */
    .overflow-x-auto, .overflow-y-auto {
        -webkit-overflow-scrolling: touch;
    }

    .mobile-touch-target {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Adjust stats grid for mobile */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Mobile typography scaling */
    h1 {
        font-size: clamp(2rem, 8vw, 3.5rem) !important;
        line-height: 1.12 !important;
        word-break: break-word;
    }

    h2 {
        font-size: clamp(1.5rem, 6vw, 2.25rem) !important;
        line-height: 1.2 !important;
    }

    .filter-chip-btn {
        padding: 0.5rem 0.75rem !important;
        min-height: 38px;
        font-size: 0.75rem !important;
    }

    #tag-filters, #stack-filters {
        max-height: 180px;
        overflow-y: auto;
        padding-right: 2px;
    }
    
    /* Stack buttons on very small screens */
    .button-group {
        flex-direction: column;
        width: 100%;
    }
    
    .button-group > * {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

/* Ensure proper spacing on mobile */
@media (max-width: 640px) {
    .container {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }
    
    /* Reduce section padding on mobile */
    .section-padding {
        padding-top: 3.5rem;
        padding-bottom: 3.5rem;
    }
}

/* Mobile centering and alignment fixes */
@media (max-width: 767px) {
    /* Center text in certification badge on mobile */
    .mt-16.flex.flex-col {
        text-align: center;
    }
    
    /* Center education card content on mobile */
    .flex.items-start.justify-between.flex-wrap {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .flex.items-start.justify-between.flex-wrap > div:last-child {
        align-items: flex-start;
        margin-top: 0.5rem;
    }
    
    /* Footer email text size on mobile */
    footer .text-\[8vw\] {
        font-size: 10vw;
        word-break: break-word;
    }
}

/* --------------------------------------------------------------------------
   Coverflow Component (from project_cover_flow.html)
   -------------------------------------------------------------------------- */
.coverflow-container {
    position: relative;
    height: 450px;
    perspective: 1200px;
}

.coverflow {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cover-item {
    position: absolute;
    width: 480px;
    height: 320px;
    transition: all 0.6s ease-out;
    cursor: pointer;
    transform-style: preserve-3d;
}

.cover {
    width: 100%;
    height: 270px;
    background: var(--brand-dark);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--brand-border);
    overflow: hidden;
    position: relative;
}

.cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cover-item.center:hover {
    transform: translateX(0) translateZ(0) rotateY(0deg) scale(1.3);
}

.cover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 30%, rgba(0, 0, 0, 0.9) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cover-item:hover .cover-overlay {
    opacity: 1;
}

/* Coverflow positions */
.cover-item.center {
    transform: translateX(0) translateZ(0) rotateY(0deg) scale(1.2);
    z-index: 10;
    opacity: 1;
}

.cover-item.left-1 {
    transform: translateX(-320px) translateZ(-150px) rotateY(0deg) scale(0.9);
    z-index: 9;
    opacity: 0.8;
}

.cover-item.left-2 {
    transform: translateX(-580px) translateZ(-250px) rotateY(0deg) scale(0.7);
    z-index: 8;
    opacity: 0.5;
}

.cover-item.right-1 {
    transform: translateX(320px) translateZ(-150px) rotateY(0deg) scale(0.9);
    z-index: 9;
    opacity: 0.8;
}

.cover-item.right-2 {
    transform: translateX(580px) translateZ(-250px) rotateY(0deg) scale(0.7);
    z-index: 8;
    opacity: 0.5;
}

.cover-item.hidden {
    transform: translateX(0) translateZ(-500px) scale(0.5);
    opacity: 0;
    pointer-events: none;
}

/* Responsive coverflow */
@media (max-width: 1024px) {
    .cover-item {
        width: 360px;
        height: 260px;
    }
    
    .cover {
        height: 210px;
    }
    
    .cover-item.left-1 {
        transform: translateX(-260px) translateZ(-120px) rotateY(0deg) scale(0.85);
    }
    
    .cover-item.left-2 {
        transform: translateX(-450px) translateZ(-200px) rotateY(0deg) scale(0.65);
    }
    
    .cover-item.right-1 {
        transform: translateX(260px) translateZ(-120px) rotateY(0deg) scale(0.85);
    }
    
    .cover-item.right-2 {
        transform: translateX(450px) translateZ(-200px) rotateY(0deg) scale(0.65);
    }
}

@media (max-width: 768px) {
    .coverflow-container {
        height: 350px;
    }
    
    .cover-item {
        width: 280px;
        height: 220px;
    }
    
    .cover {
        height: 170px;
    }
    
    .cover-item.center {
        transform: translateX(0) translateZ(0) rotateY(0deg) scale(1.1);
    }
    
    .cover-item.left-1 {
        transform: translateX(-180px) translateZ(-80px) rotateY(0deg) scale(0.8);
    }
    
    .cover-item.left-2 {
        display: none;
    }
    
    .cover-item.right-1 {
        transform: translateX(180px) translateZ(-80px) rotateY(0deg) scale(0.8);
    }
    
    .cover-item.right-2 {
        display: none;
    }
}

@media (max-width: 480px) {
    .coverflow-container {
        height: 300px;
    }
    
    .cover-item {
        width: 240px;
        height: 180px;
    }
    
    .cover {
        height: 140px;
    }
    
    .cover-item.center {
        transform: translateX(0) translateZ(0) rotateY(0deg) scale(1);
    }
    
    .cover-item.left-1,
    .cover-item.right-1 {
        opacity: 0.4;
        transform: translateX(-130px) translateZ(-60px) rotateY(0deg) scale(0.7);
    }
    
    .cover-item.right-1 {
        transform: translateX(130px) translateZ(-60px) rotateY(0deg) scale(0.7);
    }
}

/* --------------------------------------------------------------------------
   Projects Directory & Card Component Styles (Explicit Light Mode)
   -------------------------------------------------------------------------- */
.project-card {
    background-color: #EDE8DF !important;
    border: 1px solid #DED9CF !important;
    color: #1C1C1A !important;
    border-radius: 4px;
    padding: 1.25rem;
    display: block;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none !important;
}

.project-card:hover {
    border-color: #E57A1A !important;
}

.project-card-title {
    color: #1C1C1A !important;
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 1.25rem;
    line-height: 1.3;
    transition: color 0.2s ease;
    margin-top: 0.25rem;
}

.project-card:hover .project-card-title {
    color: #E57A1A !important;
}

.project-card-desc {
    color: #4A453E !important;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    line-height: 1.6;
    margin-top: 0.5rem;
}

.project-card-chip {
    background-color: #F5F0E8 !important;
    border: 1px solid #DED9CF !important;
    color: #1C1C1A !important;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.625rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.filter-chip-btn {
    background-color: #EDE8DF !important;
    border: 1px solid #DED9CF !important;
    color: #1C1C1A !important;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-chip-btn:hover {
    border-color: #E57A1A !important;
    color: #E57A1A !important;
}

.filter-chip-btn.active {
    background-color: #E57A1A !important;
    border-color: #E57A1A !important;
    color: #000000 !important;
    font-weight: 700;
}
