/* Global Styles & Variables */
:root {
    /* Light Theme (Default) */
    --bg-color: #f0f4f8;
    --text-color: #1d1d1f;
    --text-secondary: #86868b;
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    --accent-gradient: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    --aurora-1: #ff9a9e;
    --aurora-2: #fad0c4;
    --aurora-3: #a18cd1;
    --nav-height: 70px;
    --section-spacing: 120px;
}

[data-theme="dark"] {
    /* Dark Theme */
    --bg-color: #050505;
    --text-color: #f5f5f7;
    --text-secondary: #a1a1a6;
    --glass-bg: rgba(20, 20, 20, 0.60);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    --accent-gradient: linear-gradient(135deg, #30cfd0 0%, #330867 100%);
    --aurora-1: #4facfe;
    --aurora-2: #00f2fe;
    --aurora-3: #43e97b;
}

html {
    scroll-behavior: smooth;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.5s ease, color 0.5s ease;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* Aurora Background Effect */
.aurora-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: var(--bg-color);
}

.aurora-blob {
    position: absolute;
    filter: blur(80px);
    opacity: 0.7;
    animation: float 10s infinite ease-in-out alternate;
    border-radius: 50%;
    transition: margin 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-theme="dark"] .aurora-blob {
    opacity: 0.5;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: var(--aurora-1);
    animation-delay: 0s;
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: var(--aurora-2);
    animation-delay: -2s;
}

.blob-3 {
    top: 40%;
    left: 40%;
    width: 40vw;
    height: 40vw;
    background: var(--aurora-3);
    animation-delay: -4s;
}

.cursor-blob {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 70%);
    top: 0;
    left: 0;
    position: fixed;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
    opacity: 0.8;
}

[data-theme="dark"] .cursor-blob {
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 70%);
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(20px, 40px) scale(1.1); }
}

@keyframes colorChangeBlob {
    0% { filter: blur(80px) hue-rotate(0deg); }
    100% { filter: blur(80px) hue-rotate(360deg); }
}

@keyframes colorChange {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

/* Glassmorphism Utilities */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 24px;
}

.glass-card {
    padding: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.2);
}

/* Navigation */
nav {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1200px;
    height: var(--nav-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    z-index: 1000;
    border-radius: 50px;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 8px; /* Space between icon and text */
}

.logo-icon {
    height: 32px;
    width: auto;
}

.logo-text {
    height: 24px; /* Slightly smaller for the text part to balance with icon */
    width: auto;
}

.logo-text-string {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.5px;
    font-family: 'Reiternal', sans-serif;
    color: var(--text-color); /* Default to text color */
}

/* Ensure branding colors are explicit */
.light-mode-logo .logo-text-string {
    color: #1d1d1f; /* Dark text for light mode */
}

.dark-mode-logo .logo-text-string {
    color: #ffffff; /* Light text for dark mode */
}

/* Light Mode: Show dark logo, hide light logo */
.light-mode-logo {
    display: flex; /* Changed to flex to support container */
}
.dark-mode-logo {
    display: none;
}

/* Dark Mode: Hide dark logo, show light logo */
[data-theme="dark"] .light-mode-logo {
    display: none;
}
[data-theme="dark"] .dark-mode-logo {
    display: flex; /* Changed to flex */
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .logo-icon {
        height: 32px;
    }
    .logo-text {
        height: 20px;
        margin-top: 2px;
    }
}

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

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: opacity 0.3s;
    font-size: 0.95rem;
    position: relative;
}

.nav-links a:hover {
    opacity: 0.6;
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--text-color);
    border-radius: 2px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle, .mobile-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    font-size: 1.2rem;
    padding: 5px;
}

/* Mobile Menu */
.mobile-menu-btn {
    display: none;
}

@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 70%;
        height: 100vh;
        background: var(--glass-bg);
        backdrop-filter: blur(30px);
        -webkit-backdrop-filter: blur(30px);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transition: right 0.4s ease;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        z-index: 999;
    }

    .nav-links.active {
        right: 0;
    }
    
    .mobile-menu-btn {
        display: block;
        z-index: 1001;
    }
}

/* Layout & Typography */
main {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
    overflow: visible;
}

section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 100px; /* Offset for fixed nav */
}

.section-padding {
    padding-bottom: var(--section-spacing);
}

h1, h2, h3 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

h1 {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 1rem;
    background: linear-gradient(to right, var(--text-color), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
    z-index: 1;
}

/* Aurora Backlight Effect */
h2::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    width: 150%;
    height: 150%;
    background: radial-gradient(circle, rgba(0, 242, 254, 0.3), transparent 60%);
    filter: blur(30px);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
}

[data-theme="light"] h2::before {
    background: radial-gradient(circle, rgba(255, 154, 158, 0.4), transparent 60%);
}

h2:hover::before {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

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

.btn {
    display: inline-block;
    padding: 12px 30px;
    background: var(--text-color);
    color: var(--bg-color);
    text-decoration: none;
    border-radius: 30px;
    font-weight: 600;
    transition: transform 0.2s, opacity 0.2s;
    border: 1px solid var(--text-color);
}

.btn:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.btn-outline {
    background: transparent;
    color: var(--text-color);
    margin-left: 1rem;
}

.btn-full {
    width: 100%;
    text-align: center;
    cursor: pointer;
}

/* Section Headers & Dividers */
.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-subtitle {
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.5rem;
}

.section-divider {
    width: 60px;
    height: 4px;
    background: var(--text-color);
    margin: 1rem auto;
    border-radius: 2px;
    opacity: 0.3;
}

/* Hero Section (Split Layout) */
.hero-section {
    align-items: center;
    min-height: 100vh;
    position: relative;
    overflow: visible;
    padding: 140px 0 2rem 0; /* Increased top padding to clear fixed nav */
}

.hero-split {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 3rem;
    align-items: center;
    width: 100%;
    overflow: visible;
}

.hero-content {
    padding-right: 2rem;
    z-index: 2;
    overflow: visible;
}

.hero-content h1 {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.hero-text {
    font-size: 1.2rem;
    max-width: 600px;
    margin-bottom: 2.5rem;
    font-weight: 400;
    color: var(--text-color);
    opacity: 0.8;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Hero Image Container - Option 2: Double Border Shift */
.hero-visual {
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    padding: 30px;
    overflow: visible;
}

.hero-image-wrapper {
    position: relative;
    overflow: visible;
    width: 100%;
    height: 100%;
    max-width: 500px;
}

.hero-image-wrapper::before,
.hero-image-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 24px;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-image-wrapper::before {
    border: 3px solid rgba(255,255,255,0.3);
    transform: translate(-15px, -15px);
    z-index: 0;
}

.hero-image-wrapper::after {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.6) 0%, rgba(118, 75, 162, 0.6) 25%, rgba(240, 147, 251, 0.6) 50%, rgba(79, 172, 254, 0.6) 75%, rgba(0, 242, 254, 0.6) 100%);
    transform: translate(15px, 15px);
    z-index: 0;
}

.hero-image-wrapper:hover::before {
    transform: translate(-22px, -22px) rotate(-3deg);
}

.hero-image-wrapper:hover::after {
    transform: translate(22px, 22px) rotate(3deg);
}

.hero-image-wrapper img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 24px;
    position: relative;
    z-index: 1;
    transition: transform 0.4s ease;
}

.hero-image-wrapper:hover img {
    transform: scale(1.03);
}

.hero-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 2px dashed var(--glass-border);
    border-radius: 24px;
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
}

.hero-placeholder i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.hero-placeholder p {
    margin: 0;
    opacity: 0.7;
}

/* Responsive Adjustments */
@media (max-width: 968px) {
    .hero-split {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-content {
        padding-right: 0;
        order: 2;
    }

    .hero-visual {
        height: 400px;
        order: 1;
        margin-bottom: 2rem;
    }
    
    .hero-content h1 {
        font-size: 3rem;
    }
    
    .hero-text {
        margin: 0 auto 2rem auto;
    }
    
    .hero-buttons {
        justify-content: center;
    }

    .hero-image-wrapper {
        max-width: 100%;
    }
}

/* About Section */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.stat-item {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-item h3 {
    font-size: 2.5rem;
    color: var(--text-color);
}

/* Services Section (Stacking) */
.stack-area {
    position: relative;
    width: 100%;
}

.stack-card {
    position: sticky;
    top: 120px; /* Offset from top to stack nicely */
    margin-bottom: 40px; /* Space between stacked cards */
    min-height: 400px;
    transform-origin: center top;
    transition: transform 0.5s ease, opacity 0.5s ease;
    background: var(--glass-bg); /* Ensure opacity for stacking */
}

.service-card {
    padding: 0;
    overflow: hidden;
}

.service-banner {
    background: rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.service-banner-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.service-number {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-color);
    opacity: 0.5;
}

.service-divider {
    opacity: 0.5;
    font-size: 1rem;
}

.service-banner h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.service-icon {
    font-size: 2rem;
    opacity: 0.3;
    color: var(--text-color);
}

.service-content {
    padding: 2rem;
}

.service-content p {
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.service-list {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8rem;
    padding: 0;
    margin: 0;
}

.service-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.service-list li i {
    color: var(--text-color);
    font-size: 0.8rem;
}

/* Portfolio Section */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.portfolio-item {
    height: 400px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    padding: 0; /* Remove padding for full image */
}

.portfolio-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    border-radius: 24px;
}

.portfolio-item:hover .portfolio-img {
    transform: scale(1.1);
}

.portfolio-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 2rem;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: white;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    border-radius: 0 0 24px 24px;
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 1;
    transform: translateY(0);
}

.portfolio-overlay p {
    color: rgba(255,255,255,0.8);
    margin-bottom: 0;
}

/* Mobile Portfolio Stacking */
.mobile-stack-view {
    display: none;
}

.portfolio-mobile-card {
    height: 60vh;
    display: flex;
    align-items: flex-end;
    color: #333; /* Default text color for these cards */
}

.portfolio-mobile-content {
    background: rgba(255,255,255,0.3);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 16px;
    width: 100%;
}

.portfolio-mobile-content p {
    color: #333;
    margin-bottom: 0;
}

/* Contact Section */
.contact-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
}

.contact-form {
    position: relative;
    overflow: hidden;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.contact-item:last-child {
    margin-bottom: 0;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

input, textarea {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

input:focus, textarea:focus {
    border-color: var(--text-color);
    background: rgba(255, 255, 255, 0.2);
}

/* Form Messages */
#formMessages {
    margin-bottom: 1.5rem;
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert i {
    font-size: 1.2rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #10b981;
}

body.dark-mode .alert-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.alert-error {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

body.dark-mode .alert-error {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.btn .btn-loader {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Contact Success Overlay */
.contact-success-overlay {
    position: absolute;
    inset: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.contact-success-overlay.active {
    opacity: 1;
    transform: scale(1);
}

.success-animation {
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.success-animation h3 {
    font-size: 1.6rem;
    margin: 1.5rem 0 0.5rem 0;
    color: var(--text-color);
}

.success-animation p {
    color: var(--text-secondary);
    margin-bottom: 0;
    font-size: 1rem;
    line-height: 1.5;
}

/* Animated Checkmark */
.success-checkmark {
    width: 80px;
    height: 115px;
    margin: 0 auto;
    position: relative;
}

.check-icon {
    width: 80px;
    height: 80px;
    position: relative;
    border-radius: 50%;
    box-sizing: content-box;
    border: 4px solid #10b981;
}

body.dark-mode .check-icon {
    border-color: #34d399;
}

.icon-line {
    height: 5px;
    background-color: #10b981;
    display: block;
    border-radius: 2px;
    position: absolute;
    z-index: 10;
}

body.dark-mode .icon-line {
    background-color: #34d399;
}

.icon-line.line-tip {
    top: 46px;
    left: 14px;
    width: 25px;
    transform: rotate(45deg);
    animation: icon-line-tip 0.75s;
    background-color: #10b981;
}

body.dark-mode .icon-line.line-tip {
    background-color: #34d399;
}

.icon-line.line-long {
    top: 38px;
    right: 8px;
    width: 47px;
    transform: rotate(-45deg);
    animation: icon-line-long 0.75s;
    background-color: #10b981;
}

body.dark-mode .icon-line.line-long {
    background-color: #34d399;
}

/* Remove unused elements */
.icon-circle, .icon-fix {
    display: none;
}

@keyframes icon-line-tip {
    0% {
        width: 0;
        left: 1px;
        top: 19px;
    }
    54% {
        width: 0;
        left: 1px;
        top: 19px;
    }
    70% {
        width: 50px;
        left: -8px;
        top: 37px;
    }
    84% {
        width: 17px;
        left: 21px;
        top: 48px;
    }
    100% {
        width: 25px;
        left: 14px;
        top: 46px;
    }
}

@keyframes icon-line-long {
    0% {
        width: 0;
        right: 46px;
        top: 54px;
    }
    65% {
        width: 0;
        right: 46px;
        top: 54px;
    }
    84% {
        width: 55px;
        right: 0px;
        top: 35px;
    }
    100% {
        width: 47px;
        right: 8px;
        top: 38px;
    }
}

.contact-form {
    position: relative;
}

/* Social Icons in Contact Section */
.social-icons-row {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--glass-border);
}

.social-icons-row a {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    font-size: 1.2rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-icons-row a:hover {
    transform: translateY(-5px);
    background: var(--text-color);
    color: var(--bg-color);
    border-color: var(--text-color);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2rem; }
    
    .hero-card { padding: 2rem; }
    .hero-buttons { display: flex; flex-direction: column; gap: 1rem; }
    .btn-outline { margin-left: 0; }
    
    .about-grid, .contact-container {
        grid-template-columns: 1fr;
    }
    
    .service-card {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .service-icon {
        position: absolute;
        right: 20px;
        bottom: 20px;
        font-size: 5rem;
    }
    
    .portfolio-grid { display: none; }
    .mobile-stack-view { display: block; }
}

/* --- PORTFOLIO & MODAL STYLES (Added) --- */

/* Filter Buttons */
.filter-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 25px;
    border-radius: 30px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.filter-btn:hover, .filter-btn.active {
    background: var(--text-color);
    color: var(--bg-color);
    border-color: var(--text-color);
}

/* --- DESKTOP: Masonry Grid --- */
.desktop-masonry {
    column-count: 3;
    column-gap: 2rem;
    display: block;
    transition: filter 0.4s ease, opacity 0.4s ease;
}

.masonry-item {
    break-inside: avoid;
    margin-bottom: 2rem;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    transform: translateZ(0); /* Fix for webkit rendering */
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.masonry-item.hidden {
    display: none;
}

.masonry-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease;
}

.masonry-item:hover img {
    transform: scale(1.05);
}

/* Glassmorphic Overlay */
.item-overlay {
    position: absolute;
    bottom: 15px;
    left: 15px;
    right: 15px;
    width: auto;
    padding: 1.25rem;
    
    /* Gradient Glass Effect */
    background: linear-gradient(
        135deg, 
        var(--glass-bg) 0%, 
        rgba(255, 255, 255, 0.05) 100%
    );
    
    /* Softer Blur */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    
    /* Subtle Border */
    border: 1px solid rgba(255, 255, 255, 0.18);
    
    /* Soft Shadow */
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
    
    border-radius: 16px;
    color: var(--text-color);
    
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 2;
}

.item-overlay h3 {
    margin-bottom: 0.25rem;
    font-size: 1.1rem;
}

.item-overlay p {
    font-size: 0.85rem;
    opacity: 0.8;
}

.masonry-item:hover .item-overlay {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* --- MOBILE: Stacking Cards (Portfolio Specific) --- */
.mobile-stack-view {
    display: none; /* Hidden by default on desktop */
    flex-direction: column;
    padding-bottom: 50px;
    transition: filter 0.4s ease, opacity 0.4s ease;
}

/* Portfolio Stack Card Base Style */
.portfolio-stack-card {
    position: sticky;
    height: 400px; /* Fixed height for uniform cards */
    margin-bottom: 40px; /* Space between start of cards */
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.2);
    transition: opacity 0.3s ease, transform 0.3s ease;
    top: 100px; /* Default top */
}

.portfolio-stack-card.hidden {
    display: none;
}

.portfolio-stack-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stack-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.stack-content h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
    color: var(--text-color);
}

.stack-content p {
    font-size: 0.9rem;
    opacity: 0.8;
    color: var(--text-color);
}

/* Animation State Class */
.blur-out {
    filter: blur(20px);
    opacity: 0;
}

/* Load More Animation */
.load-hidden {
    display: none !important;
}

.reveal-item {
    animation: revealFade 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    opacity: 0;
    transform: translateY(40px) scale(0.95);
}

@keyframes revealFade {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Stacking Logic: Progressive Top Offsets */
.portfolio-stack-card:nth-child(1) { top: 100px; }
.portfolio-stack-card:nth-child(2) { top: 110px; }
.portfolio-stack-card:nth-child(3) { top: 120px; }
.portfolio-stack-card:nth-child(4) { top: 130px; }
.portfolio-stack-card:nth-child(5) { top: 140px; }
.portfolio-stack-card:nth-child(6) { top: 150px; }
.portfolio-stack-card:nth-child(7) { top: 160px; }
.portfolio-stack-card:nth-child(8) { top: 170px; }
.portfolio-stack-card:nth-child(9) { top: 180px; }
.portfolio-stack-card:nth-child(10) { top: 190px; }
.portfolio-stack-card:nth-child(11) { top: 200px; }
.portfolio-stack-card:nth-child(12) { top: 210px; }

/* Responsive Breakpoints for Portfolio */
@media (max-width: 1024px) {
    .desktop-masonry {
        column-count: 2;
    }
}

@media (max-width: 768px) {
    .desktop-masonry {
        display: none;
    }
    
    .mobile-stack-view {
        display: flex;
    }
}

/* --- Project Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

.project-modal {
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    
    /* Premium "Ceramic" Glass Look - Light Mode Default */
    background: linear-gradient(
        145deg, 
        rgba(255, 255, 255, 0.96) 0%, 
        rgba(240, 244, 252, 0.92) 100%
    );
    
    /* Deep Blur for the remaining transparency */
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    
    /* Refined Borders */
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        inset 0 0 0 1px rgba(255, 255, 255, 0.5); /* Inner light ring */
        
    border-radius: 24px;
    overflow-y: auto;
    transform: scale(0.95) translateY(20px);
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Dark Mode Override for Modal */
[data-theme="dark"] .project-modal {
    background: linear-gradient(
        145deg, 
        rgba(32, 32, 35, 0.96) 0%, 
        rgba(15, 15, 18, 0.92) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.modal-overlay.active .project-modal {
    transform: scale(1) translateY(0);
}

.close-modal-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.close-modal-btn:hover {
    transform: rotate(90deg);
    background: rgba(0, 0, 0, 0.7);
}

.modal-hero {
    width: 100%;
    height: 400px;
    position: relative;
    flex-shrink: 0;
}

.modal-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-content {
    padding: 40px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.modal-title h2 {
    font-size: 2.8rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    letter-spacing: -0.02em;
    font-weight: 700;
}

.modal-title p {
    font-size: 1.2rem;
    opacity: 0.8;
    font-weight: 400;
    color: var(--text-secondary);
}

.client-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    background: rgba(125, 125, 125, 0.08);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    backdrop-filter: blur(5px);
}

.client-logo {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #ddd;
}

.project-grid-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--glass-border);
}

.info-item h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.6;
    margin-bottom: 8px;
    font-weight: 600;
}

.info-item p {
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text-color);
}

.project-description {
    font-size: 1.15rem;
    line-height: 1.8;
    margin-bottom: 50px;
    color: var(--text-color);
    opacity: 0.95; /* Increased contrast */
    max-width: 800px;
}

.project-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.gallery-img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 16px;
    cursor: zoom-in;
    transition: opacity 0.3s ease;
}

.gallery-img:hover, .modal-hero img:hover {
    opacity: 0.9;
}

.modal-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in;
    transition: opacity 0.3s ease;
}

/* Image Lightbox */
.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: zoom-out;
}

.image-lightbox.active {
    display: flex;
    opacity: 1;
}

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

.lightbox-img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    transform-origin: center; /* Changed to center for scale effects */
    will-change: transform, opacity, filter;
}

/* Glassmorphic Slide Transitions */
.lightbox-img.glass-transition {
    transition: transform 0.5s cubic-bezier(0.2, 0, 0, 1), opacity 0.4s ease, filter 0.4s ease;
}

.lightbox-img.slide-next-out {
    transform: translateX(-50px) scale(1.1);
    opacity: 0;
    filter: blur(15px);
}

.lightbox-img.slide-prev-out {
    transform: translateX(50px) scale(0.9);
    opacity: 0;
    filter: blur(15px);
}

.lightbox-img.slide-next-in-start {
    transform: translateX(50px) scale(0.9);
    opacity: 0;
    filter: blur(15px);
    transition: none !important;
}

.lightbox-img.slide-prev-in-start {
    transform: translateX(-50px) scale(1.1);
    opacity: 0;
    filter: blur(15px);
    transition: none !important;
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 30px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: background 0.3s ease;
    z-index: 10001;
    backdrop-filter: blur(5px);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.4);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 50%;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav.prev {
    left: 20px;
}

.lightbox-nav.next {
    right: 20px;
}

/* Hide nav on mobile if needed, or adjust size */
@media (max-width: 768px) {
    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .lightbox-nav.prev {
        left: 10px;
    }

    .lightbox-nav.next {
        right: 10px;
    }
}


/* Mobile Bottom Sheet Style */
@media (max-width: 768px) {
    .modal-overlay {
        align-items: flex-end; /* Align to bottom */
        padding: 0;
    }

    .project-modal {
        max-height: 85vh;
        border-radius: 24px 24px 0 0; /* Top corners only */
        transform: translateY(100%);
        width: 100%;
        max-width: 100%;
    }

    .modal-overlay.active .project-modal {
        transform: translateY(0);
    }

    .modal-hero {
        height: 250px;
    }

    .modal-content {
        padding: 25px;
    }

    .modal-title h2 {
        font-size: 1.8rem;
    }

    .project-gallery {
        grid-template-columns: 1fr;
    }
}
