/* ============================================
   PORTFOLIO CSS - REFACTORED
   All common patterns extracted here
   Page-specific colors override via inline <style>
   ============================================ */

/* ============================================
   1. RESET & BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Default colors (can be overridden per page) */
    --primary: #4a9eff;
    --secondary: #00ff88;
    --accent: #00ffea;
    --danger: #ff4a4a;
    --warning: #f59e0b;
    --bg-dark: #0a0a0a;
    --bg-card: #1a1a1a;
    --text-primary: #f0f0f0;
    --text-secondary: #b0b0b0;
    --border: #333;
}

html {
    scroll-behavior: smooth;
    background: var(--bg-dark);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    position: relative;
}

/* Radial gradient background (common pattern) */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 30% 30%, rgba(74, 158, 255, 0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 70%, rgba(0, 255, 136, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ============================================
   2. TYPOGRAPHY
   ============================================ */
h2 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: #fff;
}

h3 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

h4 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

p {
    line-height: 1.8;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

strong {
    color: var(--primary);
    font-weight: 600;
}

/* ============================================
   3. NAVIGATION
   ============================================ */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    padding: 1rem 0;
    transition: all 0.3s ease;
}

nav.scrolled {
    padding: 0.5rem 0;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

nav .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav .logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
    text-decoration: none;
    transition: color 0.3s;
}

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

nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

nav a {
    color: #f0f0f0;
    text-decoration: none;
    transition: color 0.3s;
    position: relative;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s;
}

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

/* ============================================
   4. LAYOUT CONTAINERS
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.section {
    padding: 5rem 0;
    position: relative;
    z-index: 1;
    background: transparent;
}

/* Section backgrounds removed to prevent horizontal seams.
   Global gradient now handled by body::before pseudo-element. */

/* ============================================
   5. HERO SECTIONS
   ============================================ */

/* Home page hero */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: transparent;
}

.hero-content {
    text-align: center;
    z-index: 1;
}

.hero h1 {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0;
    animation: fadeInUp 1s ease forwards;
}

.hero .tagline {
    font-size: 1.5rem;
    color: #b8b8b8;
    margin-bottom: 1rem;
    opacity: 0;
    animation: fadeInUp 1s ease 0.2s forwards;
}

.hero .hero-subline {
    font-size: 1.1rem;
    color: #b0b0b0;
    max-width: 700px;
    margin: 0 auto 2.5rem;
    line-height: 1.6;
    opacity: 0;
    animation: fadeInUp 1s ease 0.3s forwards;
}

.hero-cta-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    opacity: 0;
    animation: fadeInUp 1s ease 0.4s forwards;
}

/* Case study hero (common pattern) */
.case-study-hero {
    margin-top: 80px;
    min-height: 450px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 3px solid var(--primary);
    position: relative;
    overflow: hidden;
}

.case-study-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(74, 158, 255, 0.15) 0%, transparent 60%);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.1); opacity: 0.6; }
}

.hero-content-center {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 900px;
    padding: 0 2rem;
}

.hero-title {
    font-size: 4rem;
    font-weight: 300;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.hero-stats-inline {
    display: flex;
    gap: 3rem;
    justify-content: center;
    font-size: 1.2rem;
    flex-wrap: wrap;
}

.hero-stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.hero-stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

/* ============================================
   6. SECTION HEADERS
   ============================================ */
.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-header h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-header p {
    font-size: 1.25rem;
    color: #b0b0b0;
}

.section-intro {
    font-size: 1.1rem;
    color: #b8b8b8;
    margin-bottom: 3rem;
    text-align: center;
}

/* ============================================
   7. CARDS (Generic patterns)
   ============================================ */

/* Project cards (home page) */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.project-card {
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid var(--border);
    cursor: pointer;
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border-color: var(--primary);
}

.project-image {
    height: 200px;
    background: linear-gradient(45deg, #1a1a1a, #2a2a2a);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 1.2rem;
    position: relative;
    overflow: hidden;
}

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

.project-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    opacity: 0;
    transition: opacity 0.3s;
}

.project-card:hover .project-image::after {
    opacity: 0.1;
}

.project-content {
    padding: 2rem;
}

.project-tags {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.tag {
    font-size: 0.8rem;
    padding: 0.25rem 0.75rem;
    background: rgba(74, 158, 255, 0.2);
    color: var(--primary);
    border-radius: 20px;
}

.tag.live-service {
    background: rgba(0, 255, 136, 0.2);
    color: var(--secondary);
}

.tag.systems {
    background: rgba(255, 74, 74, 0.2);
    color: var(--danger);
}

.project-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #fff;
}

.project-subtitle {
    font-size: 1rem;
    color: #b0b0b0;
    margin-bottom: 1rem;
}

.project-description {
    color: #b0b0b0;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.project-cta {
    display: inline-block;
    margin-top: 1rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s;
}

.project-cta:hover {
    color: #fff;
    transform: translateX(5px);
}

/* Flagship cards (larger variants) */
.case-studies-grid {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 3rem;
}

.flagship-card {
    border: 2px solid var(--border);
}

.flagship-card:hover {
    border-color: var(--primary);
    box-shadow: 0 25px 50px rgba(74, 158, 255, 0.2);
}

/* Generic card (flexible) */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.card-content {
    padding: 2rem;
}

/* ============================================
   8. INSIGHT/HIGHLIGHT CARDS
   ============================================ */
.insight-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
    border-left: 4px solid var(--primary);
    padding: 2rem;
    border-radius: 8px;
    margin: 2rem 0;
    position: relative;
    overflow: hidden;
}

.insight-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(74, 158, 255, 0.05) 0%, transparent 50%);
}

/* ============================================
   9. GRIDS (Common layouts)
   ============================================ */

/* 2-column grid */
.two-column-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

/* 3-column grid */
.three-column-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
}

/* Auto-fit grid (flexible) */
.auto-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

/* ============================================
   10. LISTS (Custom bullets)
   ============================================ */
.custom-list {
    list-style: none;
    padding: 0;
}

.custom-list li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-secondary);
}

.custom-list li::before {
    content: 'â–¸';
    position: absolute;
    left: 0;
    color: var(--primary);
}

/* ============================================
   11. BUTTONS & CTAs
   ============================================ */
.cta-button {
    display: inline-block;
    padding: 1rem 2rem;
    background: var(--primary);
    color: #000;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: all 0.3s;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(74, 158, 255, 0.5);
}

.cta-button.cta-secondary,
.cta-button.secondary {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.cta-button.cta-secondary:hover,
.cta-button.secondary:hover {
    background: var(--primary);
    color: #000;
    box-shadow: 0 10px 30px rgba(74, 158, 255, 0.3);
}

.back-to-portfolio {
    display: inline-block;
    margin-bottom: 2rem;
    color: var(--primary);
    text-decoration: none;
    transition: all 0.3s ease;
    opacity: 0.8;
}

.back-to-portfolio:hover {
    transform: translateX(-3px);
    opacity: 1;
}

/* ============================================
   12. BADGES & TAGS
   ============================================ */
.impact-badges {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.impact-badge {
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid rgba(255, 68, 68, 0.3);
    padding: 0.75rem 1.5rem;
    border-radius: 24px;
    font-size: 0.9rem;
    color: var(--primary);
    backdrop-filter: blur(8px);
}

/* ============================================
   13. IMAGES & MEDIA
   ============================================ */
img {
    max-width: 100%;
    height: auto;
}

.icon {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    object-fit: cover;
}

/* ============================================
   14. FOOTER
   ============================================ */
footer {
    text-align: center;
    padding: 2rem;
    color: #b0b0b0;
    border-top: 1px solid var(--border);
}

/* ============================================
   15. ABOUT SECTION
   ============================================ */
.about-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 4rem;
    align-items: center;
}

.about-image {
    width: 300px;
    height: 300px;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 1.2rem;
    font-weight: bold;
    overflow: hidden;
}

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

.about-text h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #fff;
}

.about-text p {
    color: #b0b0b0;
    margin-bottom: 2rem;
    font-size: 1.1rem;
    line-height: 1.7;
}

.contact-links {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
}

.contact-link {
    display: inline-block;
    padding: 1rem 2rem;
    background: transparent;
    color: var(--primary);
    text-decoration: none;
    border: 2px solid var(--primary);
    border-radius: 4px;
    transition: all 0.3s;
}

.contact-link:hover {
    background: var(--primary);
    color: #000;
}

/* ============================================
   16. ANIMATIONS
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   17. MOBILE MENU
   ============================================ */
.mobile-menu {
    display: none;
}

/* ============================================
   18. RESPONSIVE (Mobile)
   ============================================ */
@media (max-width: 768px) {
    /* Navigation */
    nav ul {
        display: none;
    }
    
    .mobile-menu {
        display: block;
        cursor: pointer;
    }
    
    .mobile-menu span {
        display: block;
        width: 25px;
        height: 3px;
        background: #fff;
        margin: 5px 0;
        transition: 0.3s;
    }
    
    /* Hero adjustments */
    .hero h1, .hero-title {
        font-size: 2.5rem;
    }
    
    .hero .hero-subline {
        font-size: 1rem;
        padding: 0 1rem;
    }
    
    .hero-cta-group {
        flex-direction: column;
        align-items: center;
    }
    
    .cta-button {
        width: 100%;
        max-width: 300px;
        text-align: center;
    }
    
    .hero-stats-inline {
        flex-direction: column;
        gap: 1rem;
    }
    
    .case-study-hero {
        min-height: 400px;
    }
    
    /* Layout adjustments */
    .about-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .about-image {
        margin: 0 auto;
    }
    
    .contact-links {
        flex-direction: column;
        align-items: center;
    }
    
    .projects-grid,
    .case-studies-grid,
    .auto-grid {
        grid-template-columns: 1fr;
    }
    
    .two-column-grid,
    .three-column-grid {
        grid-template-columns: 1fr;
    }
}
