/* Base & Resets */
body {
    overflow-x: clip;
    width: 100%;
}

/* Hide custom cursor on mobile to avoid buggy touch interactions */
@media (pointer: coarse) {

    .cursor-dot,
    .cursor-outline {
        display: none !important;
    }
}

@media (pointer: fine) {
    body {
        cursor: none;
    }
}

/* Noise Texture Overlay */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.04;
    background-image: url('data:image/svg+xml;utf8,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noiseFilter"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)"/%3E%3C/svg%3E');
}

/* Lenis Smooth Scroll Recommended CSS */
html.lenis {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto;
}

.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}

.lenis.lenis-stopped {
    overflow: hidden;
}

/* Utility class to hide scrollbar but keep functionality */
.hide-scrollbars {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

.hide-scrollbars::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

/* Typography sizing adjusted for mobile */
.text-huge {
    font-size: clamp(2.5rem, 10vw, 10rem);
    line-height: 0.95;
    word-break: break-word;
}

/* Reveal Animations */
.reveal-text {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
}

.reveal-text .line {
    transform: translateY(100%);
    opacity: 0;
    transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1), opacity 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-text.is-visible .line {
    transform: translateY(0);
    opacity: 1;
}

/* Magnetic Button */
.btn-magnetic {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 2rem;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    font-size: 0.75rem;
    overflow: hidden;
    transition-property: color, background-color, border-color;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 300ms;
}

.btn-magnetic:hover {
    border-color: #E25D1E;
    color: white;
    background-color: transparent;
}

@media (min-width: 768px) {
    .btn-magnetic {
        padding-left: 2.5rem;
        padding-right: 2.5rem;
        font-size: 0.875rem;
    }
}

.btn-magnetic::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: #E25D1E;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 50% 50% 0 0;
    z-index: -1;
}

.btn-magnetic:hover::before {
    transform: translateY(-100%);
    border-radius: 0;
}

/* Custom Cursor styling */
.cursor-dot,
.cursor-outline {
    position: fixed;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: 10000;
    pointer-events: none;
}

.cursor-dot {
    width: 8px;
    height: 8px;
    background-color: #E25D1E;
}

.cursor-outline {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: width 0.3s, height 0.3s, background-color 0.3s, border 0.3s;
    mix-blend-mode: difference;
}

.cursor-outline.hovering {
    width: 80px;
    height: 80px;
    background-color: #fff;
    border-color: transparent;
    mix-blend-mode: difference;
}

/* Layout Utilities */
.grid-lines {
    background-image: linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 100px 100px;
}

.text-gradient {
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    background-image: linear-gradient(to right, #E25D1E, #FEF08A);
}

/* Portfolio & Modal Styles */
.project-card {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background-color: #111111;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition-property: all;
    transition-duration: 500ms;
    aspect-ratio: 4/3;
    border-radius: 0;
}

.project-card:hover {
    border-color: #E25D1E;
    box-shadow: 8px 8px 0px rgba(226, 93, 30, 0.5);
    transform: translate(-0.25rem, -0.25rem);
}

.project-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition-property: transform;
    transition-duration: 700ms;
    opacity: 0.8;
}

.project-card:hover img {
    transform: scale(1.05);
    opacity: 1;
}

.project-overlay {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(to top, #030303, rgba(3, 3, 3, 0.9), transparent);
    opacity: 0;
    transition-property: all;
    transition-duration: 500ms;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.5rem;
}

@media (min-width: 768px) {
    .project-overlay {
        padding: 2rem;
    }
}

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

.project-tag {
    padding: 0.25rem 0.75rem;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 0;
    font-size: 0.75rem;
    font-family: 'Syne', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: inline-block;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(3, 3, 3, 0.95);
    backdrop-filter: blur(12px);
    opacity: 0;
    pointer-events: none;
    transition-property: opacity;
    transition-duration: 300ms;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: 100%;
    height: 100%;
    background-color: #111111;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition-property: transform;
    transition-duration: 500ms;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@media (min-width: 768px) {
    .modal-content {
        width: 90vw;
        height: 90vh;
        border-radius: 0;
    }
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-body {
    overflow-y: auto;
    padding: 1.5rem;
}

@media (min-width: 768px) {
    .modal-body {
        padding: 3rem;
    }
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 10;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 9999px;
    color: white;
    transition-property: color, background-color;
    transition-duration: 150ms;
    cursor: pointer;
}

.modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #E25D1E;
}

.modal-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background-color: #030303;
    gap: 1rem;
}

@media (min-width: 768px) {
    .modal-header {
        flex-direction: row;
        align-items: center;
        padding: 1.5rem;
        gap: 0;
    }
}

.modal-controls {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}

@media (min-width: 768px) {
    .modal-controls {
        width: auto;
        justify-content: flex-end;
    }
}

.device-toggle {
    display: flex;
    flex: 1 1 0%;
    gap: 0.5rem;
    background-color: rgba(255, 255, 255, 0.05);
    padding: 0.25rem;
    border-radius: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@media (min-width: 768px) {
    .device-toggle {
        flex: none;
    }
}

.toggle-btn {
    flex: 1 1 0%;
    padding: 0.5rem 0.75rem;
    border-radius: 0;
    font-size: 0.875rem;
    font-family: 'Syne', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: #6b7280;
    transition-property: color, background-color, border-color;
    transition-duration: 150ms;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

@media (min-width: 768px) {
    .toggle-btn {
        flex: none;
        padding: 0.625rem 1.25rem;
    }
}

.toggle-btn.active {
    background-color: #E25D1E;
    color: white;
}

.toggle-btn:hover:not(.active) {
    color: white;
}

.close-btn {
    width: 2.5rem;
    height: 2.5rem;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition-property: all;
    transition-duration: 300ms;
}

.close-btn:hover {
    background-color: #E25D1E;
    border-color: #E25D1E;
}

.iframe-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition-property: all;
    transition-duration: 500ms;
    max-width: 100%;
    background-color: #030303;
}

.iframe-container.mobile-view {
    max-width: 375px;
    margin-left: auto;
    margin-right: auto;
}

.iframe-wrapper {
    width: 100%;
    height: 100%;
    background-color: #030303;
    position: relative;
    transition-property: all;
    transition-duration: 500ms;
    overflow: hidden;
}

@media (min-width: 768px) {
    .iframe-wrapper {
        border-radius: 0;
    }
}

.mobile-view .iframe-wrapper {
    border: 12px solid #111111;
    border-radius: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    height: 812px;
}

.mobile-view .iframe-wrapper::before {
    display: none;
}