/* ============================================
   Portfolio PWA – Custom Styles
   Layered on top of Tailwind CSS
   ============================================ */

/* --- Base & Reset --- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

::selection {
    background-color: #c8ff00;
    color: #0a0a0a;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: pan-x pan-y;
}


body {
    overflow-x: hidden;
    /* Space for fixed marquee bar at bottom */
    padding-bottom: calc(3rem + env(safe-area-inset-bottom, 0px));
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
    background: #404040;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #525252;
}

/* --- Grid Background Pattern --- */
.bg-grid {
    background-image:
        linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
    background-size: 60px 60px;
}

/* --- Hero Slideshow --- */
.hero-slide {
    opacity: 0;
    transition: opacity 1.2s ease-in-out;
    will-change: opacity, transform;
}

.hero-slide.active {
    opacity: 1;
}

.hero-slide img {
    transform: scale(1);
    animation: kenBurns 12s ease-in-out infinite alternate;
}

@keyframes kenBurns {
    0% {
        transform: scale(1) translate(0, 0);
    }

    100% {
        transform: scale(1.08) translate(-1%, -0.5%);
    }
}

/* Stagger different start points for visual variety */
.hero-slide:nth-child(2n) img {
    animation-direction: alternate-reverse;
    transform-origin: top right;
}

.hero-slide:nth-child(3n) img {
    transform-origin: bottom left;
}

/* --- Glassmorphism Card --- */
.glass-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(200, 255, 0, 0.15);
    transform: translateY(-2px);
}

/* --- Page Loader --- */
#page-loader {
    transition: opacity 0.5s ease;
}

.loader-line {
    height: 1px;
    background: #c8ff00;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Scroll Line Animation --- */
.scroll-line {
    animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {

    0%,
    100% {
        opacity: 0.3;
        transform: scaleY(1);
    }

    50% {
        opacity: 0.8;
        transform: scaleY(1.5);
    }
}

/* --- Masonry Grid --- */
.masonry-grid {
    column-count: 2;
    column-gap: 1.5rem;
}

@media (min-width: 640px) {
    .masonry-grid {
        column-count: 3;
    }
}

@media (min-width: 1024px) {
    .masonry-grid {
        column-count: 4;
    }
}

@media (min-width: 1400px) {
    .masonry-grid {
        column-count: 5;
    }
}

/* --- Gallery Item --- */
.gallery-item {
    opacity: 0;
    transform: translateY(30px);
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    margin-bottom: 1.5rem;
}

.gallery-item img {
    width: 100%;
    height: auto;
    /* Allow natural height for masonry */
    display: block;
    /* Remove bottom space */
}

.gallery-item.hidden-item {
    display: none !important;
}

/* --- Filter Buttons --- */
.filter-btn.active {
    background-color: #c8ff00;
    color: #0a0a0a;
    border-color: #c8ff00;
}

/* --- Navbar State --- */
.navbar-scrolled {
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* --- Burger Animation --- */
.nav-open .burger-line-1 {
    transform: rotate(45deg) translate(4px, 4px);
}

.nav-open .burger-line-2 {
    opacity: 0;
}

.nav-open .burger-line-3 {
    transform: rotate(-45deg) translate(4px, -4px);
}

/* --- Form Focus Glow --- */
input:focus,
textarea:focus {
    box-shadow: 0 1px 0 0 #c8ff00;
}

/* --- Form Feedback --- */
.form-success {
    color: #c8ff00;
}

.form-error {
    color: #ef4444;
}

/* --- Loading spinner (for form submit) --- */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #0a0a0a;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Legal Pages --- */
.legal-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fafafa;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.legal-content h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #e5e5e5;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.legal-content p {
    color: #a3a3a3;
    line-height: 1.8;
    margin-bottom: 1rem;
}

.legal-content ul {
    list-style: disc;
    padding-left: 1.5rem;
    color: #a3a3a3;
    margin-bottom: 1rem;
}

.legal-content ul li {
    margin-bottom: 0.5rem;
    line-height: 1.7;
}

.legal-content a {
    color: #c8ff00;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* --- Marquee Ticker --- */
.marquee-section {
    /* Always fixed at bottom of viewport */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    background: rgba(10, 10, 10, 0.92);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.marquee-track {
    display: flex;
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.marquee-content {
    padding-right: 2rem;
}


/* --- Spinning text ring around photo --- */
@keyframes spinText {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@-webkit-keyframes spinText {
    from {
        -webkit-transform: rotate(0deg);
    }

    to {
        -webkit-transform: rotate(360deg);
    }
}

.spinning-text {
    animation: spinText 15s linear infinite;
    transform-origin: center center;
    will-change: transform;
    display: block;
    z-index: 10;
    pointer-events: none;
    /* Ensure clicks pass through to photo */
}


/* Hover effect removed to prevent sticking on mobile */

/* --- Lightbox --- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.open {
    opacity: 1;
    visibility: visible;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.lightbox-content {
    position: relative;
    z-index: 101;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    user-select: none;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    z-index: 102;
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 1rem;
    transition: opacity 0.2s, transform 0.2s;
    opacity: 0.7;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    opacity: 1;
    transform: scale(1.1);
}

.lightbox-close {
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    line-height: 1;
}

.lightbox-prev {
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-prev:hover {
    transform: translateY(-50%) scale(1.1);
}

.lightbox-next:hover {
    transform: translateY(-50%) scale(1.1);
}

.lightbox-info {
    position: absolute;
    bottom: 2rem;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 102;
    pointer-events: none;
}

.lightbox-title {
    display: block;
    color: white;
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.lightbox-counter {
    display: block;
    color: rgba(255, 255, 255, 0.6);
    font-family: monospace;
    font-size: 0.9rem;
}

@media (max-width: 768px) {

    /* Arrows visible on mobile per user request */
    .lightbox-prev,
    .lightbox-next {
        opacity: 0.8;
        padding: 1.5rem;
        /* Larger touch target */
    }
}

/* --- Safe area for PWA --- */
@supports (padding-top: env(safe-area-inset-top)) {
    body {
        padding-top: env(safe-area-inset-top);
    }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    /* FORCE spinning text to animate even if user has reduced motion enabled */
    .spinning-text {
        animation-duration: 15s !important;
        animation-iteration-count: infinite !important;
    }

    .gallery-item {
        opacity: 1;
        transform: none;
    }
}

/* --- Landscape Warning (Mobile) --- */
#landscape-warning {
    display: none;
}

@media screen and (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
    #landscape-warning {
        display: flex !important;
    }

    /* Hide main content when warning is visible */
    #page-loader,
    #navbar,
    main,
    footer,
    .marquee-section {
        display: none !important;
    }

    /* Ensure body doesn't scroll */
    body {
        overflow: hidden !important;
    }
}