html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    min-height: 100dvh;
    overflow-x: hidden;
}

:root {
    --vid-blur: 0px;
    --vid-bright: 1;
}

/* Background video */
#bg-video {
    filter: blur(var(--vid-blur)) brightness(var(--vid-bright));
}

/* Animated text effect */
.wave-letter {
    display: inline-block;
    position: relative;
    padding: 0 0.08em;
    margin: 0 -0.08em;
    line-height: 1.1;
    overflow: visible;
    vertical-align: middle;
    white-space: nowrap;
    background: linear-gradient(110deg, #9ca3af 45%, #ffffff 50%, #9ca3af 55%);
    background-size: 500% 100%;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    background-position: 100% 0;
    animation: synchronized-blade 2.5s infinite linear;
    will-change: transform, background-position;
}

@keyframes synchronized-blade {
    0% {
        background-position: 100% 0;
        transform: scale(1) translateY(0);
    }
    15% {
        background-position: 50% 0;
        transform: scale(1.08) translateY(-2px);
    }
    30%, 100% {
        background-position: 0% 0;
        transform: scale(1) translateY(0);
    }
}

/* Mobile navigation dots */
.mobile-dot {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-dot.active {
    background-color: white;
    transform: scale(1.5);
    box-shadow: 0 0 8px rgba(255,255,255,0.5);
}

/* Heading layout */
.hero-title {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.2em;
    line-height: 1.1;
    white-space: nowrap;
    max-width: 100%;
}

.hero-title > span {
    display: inline-block;
    vertical-align: middle;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .hero-title {
        display: block;
        white-space: normal;
    }

    .hero-title > span {
        white-space: normal;
    }
}

/* Scroll margin offset */
section {
    scroll-margin-top: 80px;
    min-height: 100svh;
    min-height: 100dvh;
    padding-top: 5rem;
    padding-bottom: 5rem;
}

@media (max-width: 768px) {
    nav a,
    nav button {
        -webkit-tap-highlight-color: transparent;
    }

    #home .text-center {
        max-width: min(100%, 30rem);
    }

    #home h1 {
        font-size: clamp(2.75rem, 10vw, 4rem);
        line-height: 0.95;
    }

    #home p {
        font-size: clamp(1rem, 4vw, 1.35rem);
    }

    #about .max-w-7xl {
        gap: 2rem !important;
    }

    #about h2 {
        font-size: clamp(2.25rem, 7vw, 3rem);
    }

    #about h3 {
        font-size: clamp(1.1rem, 3.8vw, 1.35rem);
    }

    #portfolio h2 {
        font-size: clamp(2rem, 7vw, 2.75rem);
        margin-bottom: 1.5rem;
    }

    #portfolio .grid {
        gap: 1rem;
    }

    #contact h2 {
        font-size: clamp(2rem, 7vw, 2.75rem);
    }

    #contact p {
        font-size: 1rem;
    }
}

.portfolio-tile {
    position: relative;
    overflow: hidden;
    border-radius: 1.25rem;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(24,24,27,0.95);
    box-shadow: 0 20px 45px rgba(0,0,0,0.25);
    cursor: pointer;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.portfolio-tile:hover {
    transform: translateY(-4px);
    border-color: rgba(255,255,255,0.35);
}

.portfolio-tile--vertical {
    aspect-ratio: 9 / 16;
}

.portfolio-tile--horizontal {
    aspect-ratio: 16 / 9;
}

@media (max-width: 640px) {
    .portfolio-tile--horizontal {
        aspect-ratio: 16 / 10;
    }
}

.portfolio-cover,
.portfolio-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: linear-gradient(135deg, #111827, #27272a);
    will-change: opacity, transform, filter;
}

.portfolio-cover {
    z-index: 1;
    transition: opacity 0.45s ease, transform 0.45s ease, filter 0.45s ease;
    transform: scale(1);
    filter: blur(0px);
}

.portfolio-video {
    z-index: 0;
    opacity: 0;
    transform: scale(1.03);
    transition: opacity 0.45s ease, transform 0.45s ease;
}

.portfolio-tile.is-playing .portfolio-video {
    opacity: 1;
    transform: scale(1);
}

.portfolio-tile.is-playing .portfolio-cover {
    opacity: 0;
    transform: scale(1.04);
    filter: blur(4px);
}

.portfolio-tile__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1rem;
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.72) 100%);
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.2s ease;
    z-index: 2;
}

.portfolio-tile.is-hidden .portfolio-tile__overlay {
    opacity: 0;
}

.portfolio-controls {
    position: absolute;
    inset: auto 1rem 1rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 3;
    padding: 0.4rem 0.5rem;
    border-radius: 999px;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(8px);
}

.portfolio-tile.is-active.is-hovered .portfolio-controls,
.portfolio-tile.is-active.is-controls-pinned .portfolio-controls {
    opacity: 1;
    pointer-events: auto;
}

.portfolio-control {
    border: 0;
    background: transparent;
    color: white;
    display: grid;
    place-items: center;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.portfolio-progress {
    flex: 1;
    height: 0.4rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.25);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    min-height: 1rem;
    padding: 0.35rem 0;
    margin: 0 -0.25rem;
}

.portfolio-progress span {
    display: block;
    height: 0.4rem;
    width: 0%;
    background: white;
    transition: width 0.1s linear;
    border-radius: 999px;
}

.portfolio-time {
    color: rgba(255,255,255,0.9);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.portfolio-tile__label {
    font-size: 0.85rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #f5f5f5;
    font-weight: 700;
}

.portfolio-tile__text {
    margin-top: 0.25rem;
    font-size: 0.95rem;
    color: rgba(255,255,255,0.8);
}

.contact-break {
    display: inline-block;
    white-space: nowrap;
}

.contact-button-nowrap {
    white-space: nowrap;
}
