/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #ffffff;
    height: 100vh;
    overflow: hidden;
    background: linear-gradient(135deg, #0c0c0c 0%, #1a1a2e 50%, #16213e 100%);
    /* Optimize for mobile */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Allow text selection for better UX */
p, h1, h2, h3, a, span {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Starry night sky background */
.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="0.5" fill="white" opacity="0.8"/><circle cx="80" cy="40" r="0.3" fill="white" opacity="0.6"/><circle cx="40" cy="80" r="0.4" fill="white" opacity="0.7"/><circle cx="90" cy="10" r="0.2" fill="white" opacity="0.5"/><circle cx="10" cy="90" r="0.6" fill="white" opacity="0.9"/><circle cx="60" cy="30" r="0.3" fill="white" opacity="0.6"/><circle cx="30" cy="60" r="0.4" fill="white" opacity="0.7"/><circle cx="70" cy="70" r="0.2" fill="white" opacity="0.5"/><circle cx="50" cy="50" r="0.5" fill="white" opacity="0.8"/></svg>') repeat;
    background-size: 200px 200px;
    animation: twinkle 4s ease-in-out infinite alternate;
    z-index: -2;
}

.twinkling {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="15" cy="15" r="0.2" fill="white" opacity="0.4"/><circle cx="85" cy="35" r="0.1" fill="white" opacity="0.3"/><circle cx="35" cy="85" r="0.3" fill="white" opacity="0.5"/><circle cx="95" cy="5" r="0.1" fill="white" opacity="0.2"/><circle cx="5" cy="95" r="0.4" fill="white" opacity="0.6"/><circle cx="65" cy="25" r="0.2" fill="white" opacity="0.4"/><circle cx="25" cy="65" r="0.3" fill="white" opacity="0.5"/><circle cx="75" cy="75" r="0.1" fill="white" opacity="0.3"/><circle cx="45" cy="45" r="0.2" fill="white" opacity="0.4"/></svg>') repeat;
    background-size: 300px 300px;
    animation: twinkle 6s ease-in-out infinite alternate-reverse;
    z-index: -1;
}

/* Shooting stars */
.shooting-star {
    position: fixed;
    width: 3px;
    height: 3px;
    background: linear-gradient(90deg, #ffffff, #e0e7ff, transparent);
    border-radius: 50%;
    animation: shooting-star 3s linear infinite;
    z-index: -1;
    box-shadow: 0 0 6px #ffffff, 0 0 12px #e0e7ff;
}

.shooting-star:nth-child(1) {
    top: 20%;
    left: 100%;
    animation-delay: 0s;
    animation-duration: 4s;
}

.shooting-star:nth-child(2) {
    top: 40%;
    left: 100%;
    animation-delay: 2s;
    animation-duration: 3.5s;
}

.shooting-star:nth-child(3) {
    top: 60%;
    left: 100%;
    animation-delay: 4s;
    animation-duration: 5s;
}

/* Cosmic whales */
.cosmic-whale {
    position: fixed;
    opacity: 0.3;
    z-index: -1;
    animation: whale-drift 20s linear infinite;
}

.cosmic-whale:nth-child(1) {
    top: 15%;
    left: -100px;
    width: 80px;
    height: 40px;
    animation-delay: 0s;
    animation-duration: 25s;
}

.cosmic-whale:nth-child(2) {
    top: 70%;
    left: -100px;
    width: 60px;
    height: 30px;
    animation-delay: 10s;
    animation-duration: 30s;
}

/* Constellations */
.constellation {
    position: fixed;
    opacity: 0.4;
    z-index: -1;
    transition: opacity 2s ease-in-out;
}

.constellation-1 {
    top: 10%;
    right: 15%;
    transform: rotate(15deg);
    animation: constellation-fade 12s ease-in-out infinite;
}

.constellation-2 {
    bottom: 20%;
    left: 10%;
    transform: rotate(-10deg);
    animation: constellation-fade 12s ease-in-out infinite 3s;
}

.constellation-3 {
    top: 60%;
    right: 5%;
    transform: rotate(25deg);
    animation: constellation-fade 12s ease-in-out infinite 6s;
}

.constellation-4 {
    top: 30%;
    left: 5%;
    transform: rotate(-5deg);
    animation: constellation-fade 12s ease-in-out infinite 9s;
}

@keyframes twinkle {
    0% { opacity: 0.3; }
    100% { opacity: 1; }
}

@keyframes shooting-star {
    0% {
        transform: translateX(0) translateY(0) rotate(45deg);
        opacity: 1;
    }
    100% {
        transform: translateX(-200px) translateY(200px) rotate(45deg);
        opacity: 0;
    }
}

@keyframes whale-drift {
    0% {
        transform: translateX(0) translateY(0);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateX(calc(100vw + 100px)) translateY(-20px);
        opacity: 0;
    }
}

@keyframes constellation-fade {
    0%, 100% {
        opacity: 0.1;
        transform: scale(0.8) rotate(var(--rotation));
    }
    50% {
        opacity: 0.6;
        transform: scale(1.1) rotate(var(--rotation));
    }
}

@keyframes float {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-100vh) translateX(50px);
        opacity: 0;
    }
}

@keyframes title-pulse {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.1);
    }
}

/* Container and layout */
.container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    padding: 1rem;
}

.fullscreen-content {
    max-width: 1200px;
    width: 100%;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100vh;
    max-height: 100vh;
}

/* Hero section */
.hero {
    text-align: center;
    padding: 2rem 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    /* Add more top space for mobile */
    margin-top: 2rem;
}

/* Contact button */
.contact-button {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
}

.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    padding: 0.75rem 1.25rem;
    color: #e0e7ff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.contact-link:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.hero-title {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(3.5rem, 8vw, 6rem);
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #e0e7ff 50%, #c7d2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
    animation: title-pulse 4s ease-in-out infinite;
}

.hero-subtitle {
    font-size: clamp(1.125rem, 2.5vw, 1.5rem);
    font-weight: 500;
    margin-bottom: 1.5rem;
    color: #e0e7ff;
    opacity: 0.9;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}





/* Portfolio section */
.portfolio {
    padding: 1rem 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.portfolio h2 {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    color: #ffffff;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.project-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.project-card:hover::before {
    transform: translateX(100%);
}

.project-card:hover {
    transform: translateY(-8px);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 0 20px rgba(224, 231, 255, 0.1);
}

.project-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.project-content h3 {
    font-family: 'Nunito', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: #ffffff;
}

.project-content p {
    color: #cbd5e1;
    margin-bottom: 0;
    line-height: 1.5;
    font-size: 0.9rem;
    flex: 1;
}

.project-button-container {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

.project-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 0.6rem 1rem;
    color: #e0e7ff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.project-button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.project-link:hover {
    color: #ffffff;
    transform: translateX(4px);
}

.project-link svg {
    transition: transform 0.3s ease;
}

.project-link:hover svg {
    transform: translateX(2px);
}

/* Coming soon card */
.coming-soon {
    position: relative;
}

.coming-soon-badge {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    display: inline-block;
}

/* Footer */
.footer {
    text-align: center;
    padding: 1rem 0;
    color: #94a3b8;
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        height: auto;
        min-height: 100vh;
        overflow: auto;
    }
    
    .container {
        height: auto;
        min-height: 100vh;
        padding: 0.5rem;
        align-items: flex-start;
        padding-top: 2rem;
    }
    
    .fullscreen-content {
        height: auto;
        min-height: 100vh;
        max-height: none;
        padding: 1rem;
        gap: 2rem;
    }
    
    .hero {
        padding: 2rem 0;
        margin-top: 3rem; /* More top space on mobile */
        margin-bottom: 2rem;
    }
    
    .portfolio {
        padding: 1rem 0;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .project-card {
        padding: 1.5rem;
    }
    
    .hero-title {
        font-size: clamp(2.5rem, 8vw, 4rem);
        margin-bottom: 1rem;
    }
    
    .hero-subtitle {
        font-size: clamp(1.25rem, 4vw, 1.5rem);
        margin-bottom: 1rem;
    }
    
    .contact-link {
        padding: 0.75rem 1.25rem;
        font-size: 0.85rem;
    }
    
    /* Optimize cosmic elements for mobile */
    .cosmic-whale {
        display: none; /* Hide on mobile for better performance */
    }
    
    .particle {
        display: none; /* Hide on mobile for better performance */
    }
    
    /* Reduce constellation opacity on mobile */
    .constellation {
        opacity: 0.2;
    }
    
    /* Adjust contact button position for mobile */
    .contact-button {
        position: fixed;
        top: 1rem;
        right: 1rem;
        z-index: 100;
    }
    
    /* Ensure footer has proper spacing */
    .footer {
        margin-top: 2rem;
        padding: 1.5rem 0;
    }
}

@media (max-width: 480px) {
    body {
        height: auto;
        min-height: 100vh;
        overflow: auto;
    }
    
    .container {
        height: auto;
        min-height: 100vh;
        padding: 0.25rem;
        padding-top: 1.5rem;
    }
    
    .fullscreen-content {
        height: auto;
        min-height: 100vh;
        max-height: none;
        padding: 0.75rem;
        gap: 1.5rem;
    }
    
    .hero {
        padding: 1.5rem 0;
        margin-top: 2.5rem; /* Even more top space on small mobile */
        margin-bottom: 1.5rem;
    }
    
    .portfolio h2 {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .project-card {
        padding: 1.25rem;
    }
    
    .project-content h3 {
        font-size: 1.2rem;
        margin-bottom: 0.75rem;
    }
    
    .project-content p {
        font-size: 0.9rem;
        line-height: 1.6;
    }
    
    .contact-link {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }
    
    .project-button {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    
    /* Further optimize for very small screens */
    .hero-title {
        font-size: clamp(2rem, 7vw, 3rem);
        margin-bottom: 0.75rem;
    }
    
    .hero-subtitle {
        font-size: clamp(0.9rem, 2.5vw, 1.1rem);
        margin-bottom: 0.75rem;
    }
    
    /* Adjust contact button for very small screens */
    .contact-button {
        top: 0.75rem;
        right: 0.75rem;
    }
    
    .contact-link {
        padding: 0.5rem 0.875rem;
        font-size: 0.75rem;
    }
}

/* Landscape orientation adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .container {
        padding-top: 1rem;
    }
    
    .hero {
        padding: 1rem 0;
        margin-top: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .portfolio {
        padding: 0.5rem 0;
    }
    
    .hero-title {
        font-size: clamp(1.5rem, 4vw, 2.5rem);
        margin-bottom: 0.5rem;
    }
    
    .hero-subtitle {
        font-size: clamp(0.8rem, 2vw, 1rem);
        margin-bottom: 0.5rem;
    }
    
    .portfolio h2 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .project-card {
        padding: 1rem;
    }
    
    .project-content h3 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    .project-content p {
        font-size: 0.85rem;
    }
    
    /* Adjust contact button for landscape */
    .contact-button {
        top: 0.5rem;
        right: 0.5rem;
    }
}

/* Tablet specific adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 1rem;
        padding-top: 2rem;
    }
    
    .fullscreen-content {
        padding: 1.5rem;
        gap: 2rem;
    }
    
    .hero {
        margin-top: 2rem;
        margin-bottom: 2rem;
    }
    
    .hero-title {
        font-size: clamp(3rem, 6vw, 4.5rem);
    }
    
    .hero-subtitle {
        font-size: clamp(1.1rem, 2.5vw, 1.3rem);
    }
    
    .projects-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 1.5rem;
    }
    
    .project-card {
        padding: 1.5rem;
    }
}

/* Additional enhancements */
.project-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(224, 231, 255, 0.02) 50%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.project-card:hover::after {
    opacity: 1;
}

/* Enhanced project card effects */
.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.project-card:hover::before {
    transform: translateX(100%);
}

/* Enhanced cosmic whale animation */
.cosmic-whale svg {
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.2));
}

/* Improved constellation visibility */
.constellation svg {
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.3));
}

/* Floating particles */
.floating-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: float 15s linear infinite;
}

.particle:nth-child(1) {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
    animation-duration: 20s;
}

.particle:nth-child(2) {
    top: 40%;
    left: 80%;
    animation-delay: 2s;
    animation-duration: 18s;
}

.particle:nth-child(3) {
    top: 60%;
    left: 20%;
    animation-delay: 4s;
    animation-duration: 22s;
}

.particle:nth-child(4) {
    top: 80%;
    left: 70%;
    animation-delay: 6s;
    animation-duration: 16s;
}

.particle:nth-child(5) {
    top: 30%;
    left: 60%;
    animation-delay: 8s;
    animation-duration: 19s;
}

.particle:nth-child(6) {
    top: 70%;
    left: 40%;
    animation-delay: 10s;
    animation-duration: 21s;
}

.particle:nth-child(7) {
    top: 50%;
    left: 30%;
    animation-delay: 12s;
    animation-duration: 17s;
}

.particle:nth-child(8) {
    top: 10%;
    left: 50%;
    animation-delay: 14s;
    animation-duration: 23s;
}

.particle:nth-child(9) {
    top: 90%;
    left: 90%;
    animation-delay: 16s;
    animation-duration: 20s;
}

/* Star field ripples */
.star-ripple {
    position: fixed;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    animation: ripple-expand 3s ease-out forwards;
}

@keyframes ripple-expand {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
        transform: translate(-50%, -50%) scale(0);
    }
    100% {
        width: 400px;
        height: 400px;
        opacity: 0;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus styles for accessibility */
.project-link:focus,
.project-card:focus-within {
    outline: 2px solid #e0e7ff;
    outline-offset: 2px;
}

/* Additional mobile-specific improvements */
@media (max-width: 768px) {
    /* Ensure proper touch targets */
    .project-button,
    .contact-link {
        min-height: 44px; /* iOS recommended touch target size */
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Improve project card touch interaction */
    .project-card {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
    }
    
    /* Better spacing for mobile content */
    .portfolio {
        margin-top: 1rem;
    }
    
    /* Ensure text is readable on mobile */
    .project-content p {
        font-size: 0.95rem;
        line-height: 1.7;
        color: #d1d5db;
    }
    
    /* Improve button visibility on mobile */
    .project-button {
        background: rgba(255, 255, 255, 0.15);
        border-color: rgba(255, 255, 255, 0.25);
        font-weight: 700;
    }
    
    /* Better contact button visibility */
    .contact-link {
        background: rgba(255, 255, 255, 0.15);
        border-color: rgba(255, 255, 255, 0.25);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
}

@media (max-width: 480px) {
    /* Even better touch targets for small screens */
    .project-button,
    .contact-link {
        min-height: 48px;
        padding: 0.75rem 1.25rem;
    }
    
    /* Improve text readability on very small screens */
    .hero-subtitle {
        font-size: 1.2rem;
        line-height: 1.6;
        padding: 0 0.5rem;
    }
    
    .project-content p {
        font-size: 0.9rem;
        line-height: 1.7;
    }
    
    /* Better spacing for very small screens */
    .fullscreen-content {
        gap: 1rem;
    }
    
    .hero {
        margin-bottom: 1rem;
    }
    
    .portfolio {
        margin-top: 0.5rem;
    }
}

/* Prevent horizontal scrolling on mobile */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }
    
    .container {
        overflow-x: hidden;
    }
    
    .fullscreen-content {
        overflow-x: hidden;
    }
}

/* Improve mobile performance by reducing animations */
@media (max-width: 768px) {
    .shooting-star {
        animation-duration: 6s; /* Slower animation for better performance */
    }
    
    .cosmic-whale {
        animation-duration: 40s; /* Much slower for mobile */
    }
    
    .constellation {
        animation-duration: 20s; /* Slower constellation animation */
    }
}

/* Better mobile navigation experience */
@media (max-width: 768px) {
    /* Ensure smooth scrolling on mobile */
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Improve focus states for mobile */
    .project-button:focus,
    .contact-link:focus {
        outline: 2px solid #e0e7ff;
        outline-offset: 2px;
        transform: scale(1.05);
    }
}
