/* Machamba Labs Portfolio - Base Styles */
/* Version 2.0.0 - Theme-agnostic shared styles */

/* ===== RESET ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ===== CSS CUSTOM PROPERTIES (defaults, overridden by themes) ===== */
:root {
    /* Spacing System (8px grid) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 16px;
    --space-4: 24px;
    --space-5: 32px;
    --space-6: 48px;
    --space-7: 64px;
    --space-8: 96px;
    --space-9: 128px;

    /* Layout */
    --max-width: 1400px;
    --content-width: 800px;

    /* Animation */
    --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --duration-fast: 150ms;
    --duration-normal: 300ms;
    --duration-slow: 500ms;

    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-2xl: 36px;
}

/* ===== NAVIGATION ===== */
nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    padding: var(--space-4) var(--space-6);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    transition: background var(--duration-normal) var(--ease-out);
}

.logo {
    font-size: 1.5rem;
    cursor: pointer;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
    list-style: none;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    opacity: 0.7;
    transition: opacity var(--duration-normal) var(--ease-out);
    cursor: pointer;
}

.nav-links a:hover,
.nav-links a.active { opacity: 1; }

/* Nav Controls (Theme/Language pickers) */
.nav-controls {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.nav-dropdown-btn svg {
    width: 12px;
    height: 12px;
    transition: transform var(--duration-fast) var(--ease-out);
}

.nav-dropdown.open .nav-dropdown-btn svg {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + var(--space-2));
    right: 0;
    min-width: 150px;
    border-radius: var(--radius-md);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--duration-fast) var(--ease-out);
    z-index: 200;
}

.nav-dropdown.open .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out);
}

.nav-dropdown-item.active {
    font-weight: 600;
}

/* ===== BACK BUTTON ===== */
.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.7;
    transition: all var(--duration-normal) var(--ease-out);
    cursor: pointer;
    margin-bottom: 2rem;
}

.back-button:hover {
    opacity: 1;
    transform: translateX(-4px);
}

.back-button svg { width: 20px; height: 20px; }

/* ===== PAGE SYSTEM ===== */
.page {
    display: none;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.page.active { display: block; }

/* ===== HERO SECTION ===== */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--space-8) var(--space-6) var(--space-6);
}

.hero-content {
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
}

.hero-eyebrow {
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.hero-eyebrow::before {
    content: '';
    width: 40px;
    height: 1px;
}

.hero-title {
    font-size: clamp(3.5rem, 10vw, 9rem);
    font-weight: 400;
    line-height: 0.95;
    letter-spacing: -0.03em;
    margin-bottom: 1.25rem;
}

.hero-subtitle {
    font-size: 1.15rem;
    max-width: 600px;
    opacity: 0.7;
    margin-bottom: 2rem;
}

/* ===== CATEGORIES SECTION ===== */
.categories-section { padding: 0 var(--space-6) var(--space-8); }

.categories-grid {
    max-width: var(--max-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

/* ===== CATEGORY CARDS ===== */
.category-card {
    position: relative;
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    min-height: 320px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    transition: transform var(--duration-slow) cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    opacity: 0;
    transition: opacity var(--duration-slow) var(--ease-out);
    border-radius: var(--radius-xl);
}

.category-card:hover {
    transform: translateY(-8px);
}

.category-card:hover::before { opacity: 1; }

.category-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    transition: transform var(--duration-slow) cubic-bezier(0.16, 1, 0.3, 1);
}

.category-card:hover .category-icon { transform: scale(1.1) rotate(-3deg); }

.category-name {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.category-description {
    font-size: 1rem;
    opacity: 0.6;
    margin-bottom: 1rem;
}

.category-count {
    font-size: 0.8rem;
}

.category-arrow {
    position: absolute;
    bottom: 2.5rem;
    right: 2.5rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-normal) var(--ease-out);
}

.category-card:hover .category-arrow {
    transform: translateX(4px);
}

.category-arrow svg {
    width: 20px;
    height: 20px;
}

/* ===== CATEGORY PAGE ===== */
.category-page { padding: var(--space-7) var(--space-6) var(--space-5); }

.category-header {
    max-width: var(--max-width);
    margin: 0 auto 3rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.category-page-icon {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    flex-shrink: 0;
}

.category-page-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin: 0;
    line-height: 1;
    flex-shrink: 0;
}

.category-page-description {
    font-size: 1rem;
    opacity: 0.7;
    line-height: 1.5;
    margin: 0;
    flex: 1;
}

.category-projects {
    max-width: var(--max-width);
    margin: 0 auto;
    display: grid;
    gap: 2rem;
}

/* ===== PROJECT CARDS ===== */
.project-card {
    border-radius: var(--radius-xl);
    overflow: hidden;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    min-height: 280px;
    transition: transform var(--duration-slow) cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
}

.project-card:hover {
    transform: translateY(-8px);
}

.project-card:nth-child(even) { direction: rtl; }
.project-card:nth-child(even) > * { direction: ltr; }

.project-content {
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.project-meta {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.project-tag {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
}

.project-name {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    line-height: 1.1;
}

.project-description {
    font-size: 0.95rem;
    opacity: 0.7;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.project-tech {
    font-size: 0.7rem;
    opacity: 0.8;
}

.project-visual {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.project-icon-wrapper {
    width: 240px;
    height: 240px;
    border-radius: var(--radius-2xl);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    animation: float 6s ease-in-out infinite;
}

.project-icon-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-2xl);
}

/* ===== PROJECT DETAIL PAGE ===== */
.project-page { padding: var(--space-7) var(--space-6) var(--space-5); }

.project-detail {
    max-width: 1200px;
    margin: 0 auto;
}

.project-detail-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 3rem;
    align-items: start;
    margin-bottom: 2.5rem;
    padding-bottom: 2.5rem;
}

.project-detail-icon {
    width: 180px;
    height: 180px;
    border-radius: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.project-detail-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 40px;
}

.project-detail-title {
    font-size: clamp(3rem, 7vw, 5rem);
    margin-bottom: 1rem;
    line-height: 1;
}

.project-detail-tagline {
    font-size: 1.25rem;
    opacity: 0.7;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.project-detail-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.project-detail-section { margin-bottom: 2.5rem; }

.project-detail-section h3 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.project-detail-section p {
    font-size: 1.1rem;
    opacity: 0.8;
    line-height: 1.8;
    margin-bottom: 1rem;
}

/* ===== FEATURES GRID ===== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.feature-item {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
}

.feature-item h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.feature-item p {
    font-size: 0.9rem;
    opacity: 0.6;
    margin: 0;
}

/* ===== TECH LIST ===== */
.tech-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.tech-item {
    font-size: 0.85rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
}

/* ===== CATEGORY INTRO ===== */
.category-intro {
    max-width: var(--max-width);
    margin: 3rem auto 0;
    padding: 2.5rem;
    border-radius: var(--radius-xl);
}

.category-intro h3 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.category-intro p {
    font-size: 1.1rem;
    opacity: 0.7;
    line-height: 1.8;
    margin-bottom: 1rem;
}

/* ===== ABOUT PAGE ===== */
.about-page { padding: var(--space-7) var(--space-6) var(--space-5); }

.about-content {
    max-width: var(--max-width);
    margin: 0 auto;
}

.about-header {
    margin-bottom: var(--space-6);
}

.about-title {
    font-size: clamp(3rem, 8vw, 6rem);
    margin-bottom: 1rem;
}

.about-subtitle {
    font-size: 1.35rem;
    opacity: 0.7;
    max-width: 700px;
    line-height: 1.7;
}

.about-section {
    margin-bottom: var(--space-6);
}

.about-section-title {
    font-size: 1.75rem;
    margin-bottom: var(--space-4);
}

/* Team Grid */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-5);
}

.team-card {
    padding: var(--space-5);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.team-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 500;
    margin-bottom: var(--space-4);
}

.team-name {
    font-size: 1.5rem;
    margin-bottom: var(--space-2);
}

.team-role {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: var(--space-3);
    opacity: 0.8;
}

.team-focus {
    font-size: 0.85rem;
    opacity: 0.6;
    line-height: 1.6;
}

/* Values */
.values-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-4);
}

.value-item {
    padding: var(--space-5);
    border-radius: var(--radius-lg);
}

.value-item h4 {
    font-size: 1.1rem;
    margin-bottom: var(--space-2);
}

.value-item p {
    font-size: 0.95rem;
    opacity: 0.7;
    line-height: 1.6;
    margin: 0;
}

/* Location */
.location-block {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    width: fit-content;
}

.location-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.location-text {
    font-size: 1.1rem;
}

/* ===== FOOTER ===== */
footer {
    padding: var(--space-5);
    position: relative;
    z-index: 1;
    margin-top: 2.5rem;
}

.footer-content {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-logo {
    font-size: 1.25rem;
}

.footer-text {
    font-size: 0.85rem;
    opacity: 0.5;
}

/* ===== ANIMATIONS ===== */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-delay-1 { animation-delay: 0.1s; opacity: 0; }
.animate-delay-2 { animation-delay: 0.2s; opacity: 0; }
.animate-delay-3 { animation-delay: 0.3s; opacity: 0; }
.animate-delay-4 { animation-delay: 0.4s; opacity: 0; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .categories-grid { grid-template-columns: 1fr; }

    .project-card {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .project-card:nth-child(even) { direction: ltr; }

    .project-visual {
        min-height: 180px;
        order: -1;
    }

    .project-detail-header {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    nav {
        padding: 1rem 1.5rem;
        flex-wrap: wrap;
        gap: var(--space-3);
    }

    .nav-links {
        display: none;
    }

    .nav-controls {
        margin-left: auto;
    }

    .hero,
    .category-page,
    .project-page,
    .about-page,
    .categories-section {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    .category-card {
        padding: 2rem;
        min-height: 280px;
    }

    .category-name { font-size: 2rem; }

    .category-header {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .category-page-icon {
        width: 56px;
        height: 56px;
        font-size: 1.75rem;
    }

    .category-page-title {
        font-size: 1.75rem;
    }

    .category-page-description {
        flex-basis: 100%;
        font-size: 0.95rem;
    }
    .project-content { padding: 1.5rem; }
    .project-name { font-size: 1.75rem; }
    .category-intro { padding: 2rem; }

    .footer-content {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }

    .features-grid { grid-template-columns: 1fr; }

    .team-grid { grid-template-columns: 1fr; }

    .values-grid { grid-template-columns: 1fr; }
}

/* ===== UTILITY CLASSES ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
