/* ==========================================================================
   Kiwi AI Labs Portfolio - Elevated Design System
   ========================================================================== */

/* CSS Custom Properties
   ========================================================================== */
:root {
    /* Colors - Enhanced palette */
    --bg-primary: #050505;
    --bg-secondary: #0a0a0a;
    --bg-tertiary: #0f0f0f;
    --text-primary: #fafafa;
    --text-secondary: #737373;
    --text-muted: #525252;

    /* Accent colors - bolder usage */
    --accent: #8ee53f;
    --accent-bright: #a3f55a;
    --accent-dim: rgba(142, 229, 63, 0.08);
    --accent-glow: rgba(142, 229, 63, 0.15);

    /* Secondary warm tone */
    --warm: #f5a623;
    --warm-dim: rgba(245, 166, 35, 0.1);

    /* Surfaces */
    --card-bg: rgba(15, 15, 15, 0.8);
    --card-bg-hover: rgba(20, 20, 20, 0.9);
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(142, 229, 63, 0.3);

    /* Gradients */
    --gradient-accent: linear-gradient(135deg, var(--accent) 0%, var(--accent-bright) 100%);
    --gradient-dark: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    --gradient-radial: radial-gradient(ellipse at center, var(--accent-glow) 0%, transparent 70%);

    /* Animation timing */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
    --ease-in-out-circ: cubic-bezier(0.85, 0, 0.15, 1);
    --ease-elastic: cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* Spacing */
    --section-padding: clamp(4rem, 10vw, 8rem);
    --container-padding: clamp(1.5rem, 5vw, 6rem);
}

/* Reset & Base
   ========================================================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

/* Use smooth scroll only on non-iOS to avoid conflicts with GSAP */
@supports not (-webkit-touch-callout: none) {
    html {
        scroll-behavior: smooth;
    }
}

body {
    font-family: 'Satoshi', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    cursor: none;
    -webkit-overflow-scrolling: touch;
}

/* Handle horizontal overflow on main instead of body for iOS compatibility */
main {
    overflow-x: hidden;
}

/* Enhanced Grain overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.06;
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: overlay;
}

/* Disable grain overlay on touch devices - causes iOS scroll issues */
@media (hover: none) and (pointer: coarse) {
    body::before {
        display: none;
    }
}

/* Scroll Progress Bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background: var(--gradient-accent);
    z-index: 10000;
    transition: width 0.1s linear;
}

/* Custom Cursor
   ========================================================================== */
.cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    border: 1px solid var(--accent);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99999;
    transition: transform 0.15s var(--ease-out-quart),
                width 0.2s var(--ease-out-quart),
                height 0.2s var(--ease-out-quart),
                background 0.2s ease;
    transform: translate(-50%, -50%);
    mix-blend-mode: difference;
}

.cursor-dot {
    position: fixed;
    top: 0;
    left: 0;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99999;
    transform: translate(-50%, -50%);
}

.cursor.hovering {
    width: 60px;
    height: 60px;
    background: var(--accent-dim);
    border-color: transparent;
}

.cursor.clicking {
    transform: translate(-50%, -50%) scale(0.8);
}

/* Hide cursor on touch devices */
@media (hover: none) {
    .cursor, .cursor-dot { display: none; }
    body { cursor: auto; }
}

/* Navigation
   ========================================================================== */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 1.5rem var(--container-padding);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(5,5,5,0.95);
}

@media (hover: hover) {
    nav {
        background: linear-gradient(to bottom, rgba(5,5,5,0.98) 0%, rgba(5,5,5,0) 100%);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }
}

.menu-toggle {
    display: none;
}

.logo {
    font-family: 'Instrument Serif', serif;
    font-size: 1.75rem;
    font-style: italic;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    letter-spacing: -0.02em;
}

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

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: color 0.3s ease;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width 0.3s var(--ease-out-quart);
}

.nav-links a:hover {
    color: var(--text-primary);
}

.nav-links a:hover::after {
    width: 100%;
}

.nav-links .nav-offer {
    color: var(--bg-primary);
    background: var(--accent);
    padding: 0.45rem 1rem;
    border-radius: 100px;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    transition: all 0.3s var(--ease-out-expo);
}

.nav-links .nav-offer::after {
    display: none;
}

.nav-links .nav-offer:hover {
    color: var(--bg-primary);
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(142, 229, 63, 0.3);
}

.nav-links .nav-training {
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 0.45rem 1rem;
    border-radius: 100px;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    transition: all 0.3s var(--ease-out-expo);
}

.nav-links .nav-training::after {
    display: none;
}

.nav-links .nav-training:hover {
    background: var(--accent);
    color: var(--bg-primary);
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(142, 229, 63, 0.3);
}

/* Hero Section
   ========================================================================== */
.hero {
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for iOS Safari */
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: calc(var(--section-padding) + 4rem) var(--container-padding) var(--section-padding);
    position: relative;
    overflow: hidden;
}

/* Gradient mesh background - desktop only (disabled on mobile via media query) */
.hero::before {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 800px;
    height: 800px;
    background:
        radial-gradient(ellipse at 30% 30%, var(--accent-glow) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, var(--warm-dim) 0%, transparent 40%);
    filter: blur(100px);
    pointer-events: none;
    animation: float 20s ease-in-out infinite;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: -10%;
    left: -5%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-dim) 0%, transparent 60%);
    filter: blur(80px);
    pointer-events: none;
    animation: float 15s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(20px, -30px) rotate(2deg); }
    50% { transform: translate(-10px, 20px) rotate(-1deg); }
    75% { transform: translate(30px, 10px) rotate(1deg); }
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, var(--accent-dim) 0%, transparent 100%);
    border: 1px solid var(--border-hover);
    color: var(--accent);
    padding: 0.6rem 1.25rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 2.5rem;
    width: fit-content;
    opacity: 0;
    clip-path: inset(0 100% 0 0);
}

.hero-tag::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    animation: pulse 2s ease infinite;
    box-shadow: 0 0 20px var(--accent);
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 20px var(--accent); }
    50% { opacity: 0.6; transform: scale(1.3); box-shadow: 0 0 30px var(--accent); }
}

.hero h1 {
    font-family: 'Instrument Serif', serif;
    font-size: clamp(3.5rem, 10vw, 8rem);
    font-weight: 400;
    line-height: 1;
    margin-bottom: 2.5rem;
    max-width: 1000px;
    letter-spacing: -0.03em;
}

.hero h1 .line {
    display: block;
    overflow: hidden;
}

.hero h1 .word {
    display: inline-block;
    opacity: 0;
    transform: translateY(100%);
}

.hero h1 em {
    font-style: italic;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: clamp(1.1rem, 2vw, 1.35rem);
    color: var(--text-secondary);
    max-width: 580px;
    margin-bottom: 4rem;
    line-height: 1.7;
    opacity: 0;
    transform: translateY(30px);
}

/* Stats with dramatic styling */
.hero-stats {
    display: flex;
    gap: 5rem;
    opacity: 0;
    transform: translateY(30px);
}

.stat {
    display: flex;
    flex-direction: column;
    position: relative;
}

.stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: -1.5rem;
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom, var(--accent), transparent);
    opacity: 0.3;
}

.stat:first-child::before {
    display: none;
}

.stat-number {
    font-family: 'Instrument Serif', serif;
    font-size: clamp(3rem, 6vw, 4.5rem);
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-top: 0.75rem;
    font-weight: 500;
}

/* Projects Section
   ========================================================================== */
.projects {
    padding: var(--section-padding) var(--container-padding);
    position: relative;
    content-visibility: auto;
    contain-intrinsic-size: auto 3000px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 5rem;
    padding: 4rem 0;
    position: relative;
    overflow: visible;
    min-height: 200px;
}

/* Large background decorative text */
.section-bg-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Instrument Serif', serif;
    font-size: clamp(8rem, 25vw, 20rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    color: transparent;
    -webkit-text-stroke: 1px rgba(142, 229, 63, 0.08);
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
    z-index: 0;
}

.section-header-content {
    position: relative;
    z-index: 2;
}

/* Small label with animated line */
.section-label {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-label-line {
    width: 40px;
    height: 1px;
    background: var(--accent);
    position: relative;
    overflow: hidden;
}

.section-label-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--accent-bright), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.section-label-text {
    font-family: 'Satoshi', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

/* Main title styling */
.section-title {
    font-family: 'Instrument Serif', serif;
    font-size: clamp(3rem, 8vw, 5rem);
    font-weight: 400;
    line-height: 1;
    letter-spacing: -0.03em;
}

.section-title .title-line {
    display: block;
    color: var(--text-primary);
}

.section-title .title-accent {
    font-style: italic;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Count wrapper with glow effect */
.section-count-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    padding-right: 1rem;
}

.section-count-label {
    font-family: 'Satoshi', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.section-count {
    font-family: 'Instrument Serif', serif;
    font-size: clamp(4rem, 10vw, 7rem);
    font-weight: 400;
    line-height: 0.85;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-bright) 50%, var(--warm) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    filter: drop-shadow(0 0 30px rgba(142, 229, 63, 0.3));
}

.section-count::before {
    content: '';
    position: absolute;
    inset: -20px;
    background: radial-gradient(ellipse at center, rgba(142, 229, 63, 0.1) 0%, transparent 70%);
    z-index: -1;
    animation: countGlow 3s ease-in-out infinite;
}

@keyframes countGlow {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

/* Dynamic Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: minmax(300px, auto);
    gap: 2rem;
}

.project-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.5s var(--ease-out-expo);
    cursor: pointer;
    position: relative;
    text-decoration: none;
    color: inherit;
    opacity: 0;
    transform: translateY(60px);
}

@media (hover: hover) {
    .project-card {
        backdrop-filter: blur(10px);
    }
}

/* Grid-breaking layout */
/* Grid layout pattern:
   - Card 1: Featured (full width, double height)
   - Cards 2-3: 7+5 split
   - Cards 4-5: 5+7 split
   - Cards 6-7: 6+6 split
   - Cards 8-9: 6+6 split
   - Card 10+: Falls back to full width (last-child rule)
*/
.project-card:nth-child(1) { grid-column: span 12; grid-row: span 2; }
.project-card:nth-child(2) { grid-column: span 7; }
.project-card:nth-child(3) { grid-column: span 5; }
.project-card:nth-child(4) { grid-column: span 5; }
.project-card:nth-child(5) { grid-column: span 7; }
.project-card:nth-child(6) { grid-column: span 6; }
.project-card:nth-child(7) { grid-column: span 6; }
.project-card:nth-child(8) { grid-column: span 6; }
.project-card:nth-child(9) { grid-column: span 6; }

/* Fallback pattern for cards 10+:
   - Even positions (10, 12, 14...): span 7
   - Odd positions (11, 13, 15...): span 5
   - Last card if alone: full width */
.project-card:nth-child(n+10):nth-child(even) { grid-column: span 7; }
.project-card:nth-child(n+10):nth-child(odd) { grid-column: span 5; }
.project-card:nth-child(n+10):last-child:nth-child(even) { grid-column: span 12; }
.project-card:nth-child(n+10):last-child:nth-child(odd) { grid-column: span 12; }

.project-card:hover {
    transform: translateY(-12px) scale(1.01);
    border-color: var(--border-hover);
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.4),
        0 0 60px var(--accent-dim);
}

.project-card:hover .project-image img {
    transform: scale(1.08);
}

.project-card:hover .project-arrow {
    transform: translate(6px, -6px) rotate(-45deg);
    background: var(--accent);
    border-color: var(--accent);
}

.project-card:hover .project-arrow svg {
    stroke: var(--bg-primary);
}

.project-card:hover .project-number {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Project number overlay */
.project-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    font-family: 'Instrument Serif', serif;
    font-size: clamp(8rem, 20vw, 15rem);
    color: transparent;
    -webkit-text-stroke: 1px var(--accent);
    opacity: 0;
    transition: all 0.5s var(--ease-out-expo);
    z-index: 3;
    pointer-events: none;
    line-height: 1;
}

.project-image {
    aspect-ratio: 16/10;
    overflow: hidden;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    position: relative;
    /* Ensure minimum height even when images fail to load */
    min-height: 200px;
}

.project-card:nth-child(1) .project-image {
    aspect-ratio: 21/9;
}

.project-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, var(--bg-primary) 0%, transparent 50%);
    opacity: 0.6;
    pointer-events: none;
    z-index: 2;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    transition: transform 0.8s var(--ease-out-expo);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    position: relative;
    z-index: 1;
}

/* Image failed state - show nice placeholder */
.project-image.image-failed::before {
    content: 'Preview unavailable';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Satoshi', sans-serif;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    z-index: 0;
}

.project-info {
    padding: 1.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    z-index: 2;
}

.project-meta h3 {
    font-family: 'Instrument Serif', serif;
    font-size: clamp(1.25rem, 2vw, 1.6rem);
    font-weight: 400;
    margin-bottom: 0.75rem;
    letter-spacing: -0.01em;
}

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

.project-tag {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    padding: 0.35rem 0.9rem;
    border-radius: 100px;
    border: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.project-arrow {
    width: 48px;
    height: 48px;
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s var(--ease-out-expo);
    flex-shrink: 0;
}

.project-arrow svg {
    width: 18px;
    height: 18px;
    stroke: var(--text-secondary);
    transition: stroke 0.3s ease;
}

/* About Section
   ========================================================================== */
.about {
    padding: var(--section-padding) var(--container-padding);
}

.about-content {
    max-width: 720px;
}

.about-content p {
    color: var(--text-secondary);
    font-size: clamp(1rem, 1.5vw, 1.125rem);
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

/* FAQ Section
   ========================================================================== */
.faq-section {
    padding: var(--section-padding) var(--container-padding);
}

.faq-section .faq-list {
    max-width: 720px;
}

.faq-section .faq-item {
    border-bottom: 1px solid var(--border);
}

.faq-section .faq-question {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: 'Satoshi', sans-serif;
    font-size: clamp(1rem, 1.5vw, 1.125rem);
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: color 0.3s ease;
}

.faq-section .faq-question:hover {
    color: var(--accent);
}

.faq-section .faq-question svg {
    width: 20px;
    height: 20px;
    stroke: var(--text-muted);
    flex-shrink: 0;
    margin-left: 1rem;
    transition: transform 0.3s var(--ease-out-expo);
}

.faq-section .faq-item.active .faq-question svg {
    transform: rotate(45deg);
}

.faq-section .faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s var(--ease-out-expo);
}

.faq-section .faq-item.active .faq-answer {
    max-height: 300px;
}

.faq-section .faq-answer p {
    color: var(--text-secondary);
    line-height: 1.8;
    padding-bottom: 1.5rem;
}

/* Services Section - Bento Grid
   ========================================================================== */
.services {
    padding: var(--section-padding) var(--container-padding);
    background: var(--bg-secondary);
    position: relative;
    overflow: hidden;
    content-visibility: auto;
    contain-intrinsic-size: auto 800px;
}

.services::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 150px;
    background: linear-gradient(to bottom, var(--accent), transparent);
}

.services::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-dim) 0%, transparent 60%);
    filter: blur(100px);
    pointer-events: none;
}

/* Bento Grid Layout */
.services-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 5rem;
}

.service-card {
    padding: 2.5rem;
    border: 1px solid var(--border);
    border-radius: 24px;
    transition: all 0.4s var(--ease-out-expo);
    opacity: 0;
    transform: translateY(40px);
    position: relative;
    overflow: hidden;
    background: var(--card-bg);
}

@media (hover: hover) {
    .service-card {
        backdrop-filter: blur(10px);
    }
}

/* Bento positioning */

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.service-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-8px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

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

.service-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--accent-dim) 0%, transparent 100%);
    border: 1px solid var(--border-hover);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.service-card:hover .service-icon {
    background: var(--accent);
    transform: scale(1.1) rotate(-5deg);
}

.service-card:hover .service-icon svg {
    stroke: var(--bg-primary);
}

.service-icon svg {
    width: 26px;
    height: 26px;
    stroke: var(--accent);
    transition: stroke 0.3s ease;
}

.service-card h3 {
    font-family: 'Instrument Serif', serif;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 400;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}


.service-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
}


/* Contact Section
   ========================================================================== */
.contact {
    padding: calc(var(--section-padding) * 1.5) var(--container-padding);
    text-align: center;
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    content-visibility: auto;
    contain-intrinsic-size: auto 600px;
}

.contact::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1000px;
    height: 1000px;
    background:
        radial-gradient(ellipse at center, var(--accent-glow) 0%, transparent 50%),
        radial-gradient(ellipse at 30% 70%, var(--warm-dim) 0%, transparent 40%);
    filter: blur(120px);
    pointer-events: none;
    animation: contactGlow 10s ease-in-out infinite;
}

@keyframes contactGlow {
    0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.1); }
}

.contact-inner {
    position: relative;
    z-index: 2;
}

.contact h2 {
    font-family: 'Instrument Serif', serif;
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 400;
    margin-bottom: 2rem;
    letter-spacing: -0.03em;
    line-height: 1.1;
    opacity: 0;
    transform: translateY(50px);
}

.contact h2 em {
    font-style: italic;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.contact > p,
.contact-inner > p {
    color: var(--text-secondary);
    font-size: clamp(1.1rem, 2vw, 1.3rem);
    margin-bottom: 3.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.7;
    opacity: 0;
    transform: translateY(30px);
}

.contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    background: var(--accent);
    color: var(--bg-primary);
    padding: 1.35rem 3rem;
    border-radius: 100px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.02em;
    transition: all 0.4s var(--ease-out-expo);
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px);
}

.contact-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.contact-btn:hover {
    transform: scale(1.08);
    box-shadow:
        0 15px 50px rgba(142, 229, 63, 0.4),
        0 0 0 2px var(--accent-bright);
}

.contact-btn:hover::before {
    left: 100%;
}

.contact-btn svg {
    width: 22px;
    height: 22px;
    transition: transform 0.3s var(--ease-out-expo);
}

.contact-btn:hover svg {
    transform: translateX(6px);
}

/* Footer
   ========================================================================== */
footer {
    padding: 3rem var(--container-padding);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

footer::before {
    content: '';
    position: absolute;
    top: -1px;
    left: var(--container-padding);
    width: 60px;
    height: 1px;
    background: var(--accent);
}

.footer-left {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

footer p {
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

.email-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.email-link:hover {
    color: var(--accent);
}

.footer-tagline {
    font-family: 'Instrument Serif', serif;
    font-style: italic;
    color: var(--text-secondary);
    font-size: 1rem;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    width: 48px;
    height: 48px;
    border: 1px solid var(--border-hover);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: all 0.3s var(--ease-out-expo);
}

.social-links a:hover {
    color: var(--bg-primary);
    background: var(--accent);
    border-color: var(--accent);
    transform: translateY(-4px);
}

.social-links svg {
    width: 22px;
    height: 22px;
}

/* Responsive
   ========================================================================== */
@media (max-width: 1200px) {
    .projects-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .project-card:nth-child(1) { grid-column: span 6; }
    .project-card:nth-child(2) { grid-column: span 3; }
    .project-card:nth-child(3) { grid-column: span 3; }
    .project-card:nth-child(4) { grid-column: span 3; }
    .project-card:nth-child(5) { grid-column: span 3; }
    .project-card:nth-child(6) { grid-column: span 3; }
    .project-card:nth-child(7) { grid-column: span 3; }
    .project-card:nth-child(8) { grid-column: span 3; }
    .project-card:nth-child(9) { grid-column: span 3; }
    .project-card:nth-child(n+10) { grid-column: span 3; }
    .project-card:nth-child(n+10):last-child:nth-child(odd) { grid-column: span 6; }

    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* Ensure vertical scrolling works on iOS */
    html, body {
        touch-action: pan-y;
        -webkit-overflow-scrolling: touch;
    }

    .menu-toggle {
        display: flex;
        flex-direction: column;
        gap: 5px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 8px;
        z-index: 1001;
    }

    .menu-toggle span {
        display: block;
        width: 24px;
        height: 2px;
        background: var(--text-primary);
        transition: all 0.3s var(--ease-out-expo);
    }

    .menu-toggle[aria-expanded="true"] span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .menu-toggle[aria-expanded="true"] span:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle[aria-expanded="true"] span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .nav-links {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2rem;
        background: rgba(5, 5, 5, 0.98);
        z-index: 1000;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links a {
        font-size: 1.2rem;
        color: var(--text-primary);
    }

    /* Section header mobile */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 2rem;
        padding: 2rem 0;
        min-height: auto;
    }

    /* Disable expensive blur/gradient pseudo-elements on mobile */
    .hero::before,
    .hero::after,
    .services::after,
    .contact::before {
        display: none;
    }

    /* Disable continuous animations on mobile to reduce GPU/CPU usage */
    .section-label-line::after {
        animation: none;
    }

    .section-count::before {
        display: none;
    }

    .section-bg-text {
        font-size: clamp(5rem, 30vw, 10rem);
        -webkit-text-stroke: 1px rgba(142, 229, 63, 0.05);
    }

    .section-title {
        font-size: clamp(2.5rem, 12vw, 3.5rem);
    }

    .section-count-wrapper {
        align-items: flex-start;
    }

    .section-count {
        font-size: clamp(3rem, 15vw, 5rem);
    }

    .projects-grid {
        display: flex !important;
        flex-direction: column;
        gap: 1.5rem;
    }

    /* Reset ALL project cards for mobile */
    .project-card,
    .project-card:nth-child(n) {
        width: 100% !important;
        min-height: auto !important;
    }

    .project-card:nth-child(1) .project-image {
        aspect-ratio: 16/10;
    }

    /* Ensure images don't break layout when failing to load */
    .project-image {
        min-height: 180px;
    }

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

    .service-card:nth-child(n) {
        grid-column: span 1;
        grid-row: span 1;
    }

    .hero-stats {
        flex-wrap: wrap;
        gap: 2.5rem;
    }

    .stat::before {
        display: none;
    }

    footer {
        flex-direction: column;
        gap: 2rem;
        text-align: center;
    }

    footer::before {
        left: 50%;
        transform: translateX(-50%);
    }
}

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

    .cursor, .cursor-dot {
        display: none;
    }

    body {
        cursor: auto;
    }
}

/* 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;
}

/* Selection */
::selection {
    background: var(--accent);
    color: var(--bg-primary);
}

::-moz-selection {
    background: var(--accent);
    color: var(--bg-primary);
}
