@property --button-edge-angle {
    syntax: '<angle>';
    inherits: false;
    initial-value: -75deg;
}

@property --hero-reflection-angle {
    syntax: '<angle>';
    inherits: false;
    initial-value: -45deg;
}

:is(.portfolio-page, .about-page, .contact-footer) .hero-button-wrap {
    position: relative;
    isolation: isolate;
    z-index: 2;
    display: inline-flex;
    flex: 0 1 160px;
    min-width: 0;
    height: 48px;
    border-radius: 999px;
    color: #121212;
    font-size: 16px;
}

:is(.portfolio-page, .about-page, .contact-footer) .hero-glass-button {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 48px;
    padding: 0;
    border: 0;
    border-radius: inherit;
    background: linear-gradient(-75deg, #ffffff0d, #ffffff38, #ffffff0d);
    box-shadow: inset 0 2px 2px #0000000d,
        inset 0 -2px 2px #ffffff80,
        0 4px 2px -2px #0003,
        inset 0 0 1.6px 4px #fff3,
        0 0 0 0 #fff;
    color: #121212;
    font: inherit;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    transform: scale(1);
    transition: transform .45s cubic-bezier(.34, 1.8, .5, 1),
        box-shadow .4s cubic-bezier(.25, 1, .5, 1),
        backdrop-filter .4s cubic-bezier(.25, 1, .5, 1);
}

:is(.portfolio-page, .about-page, .contact-footer) .hero-glass-button::after {
    content: '';
    position: absolute;
    z-index: 1;
    inset: -.5px;
    padding: 1px;
    border-radius: inherit;
    pointer-events: none;
    background: conic-gradient(from var(--button-edge-angle) at 50% 50%,
        #00000080, #0000 5% 40%, #00000080 50%, #0000 60% 95%, #00000080),
        linear-gradient(180deg, #ffffff80, #ffffff80);
    box-shadow: inset 0 0 0 .5px #ffffff80;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    transition: --button-edge-angle .5s;
}

:is(.portfolio-page, .about-page, .contact-footer) .hero-button-content {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    height: 100%;
    padding: 0 20px;
    border-radius: inherit;
    line-height: 1;
    white-space: nowrap;
}

:is(.portfolio-page, .about-page, .contact-footer) .hero-button-content img {
    width: 16px;
    height: 16px;
    flex: none;
}

:is(.portfolio-page, .about-page, .contact-footer) .hero-button-content::after {
    content: '';
    position: absolute;
    z-index: 1;
    inset: .5px;
    border-radius: inherit;
    background: linear-gradient(var(--hero-reflection-angle),
        #fff0 0%, #ffffff8c 40% 50%, #fff0 55%);
    background-position: 0% 50%;
    background-size: 200% 200%;
    background-repeat: no-repeat;
    mix-blend-mode: screen;
    pointer-events: none;
    transition: background-position .5s cubic-bezier(.25, 1, .5, 1),
        --hero-reflection-angle .5s cubic-bezier(.25, 1, .5, 1);
}

:is(.portfolio-page, .about-page, .contact-footer) .hero-button-shadow {
    position: absolute;
    z-index: -1;
    inset: -16px;
    filter: blur(2px);
    pointer-events: none;
}

:is(.portfolio-page, .about-page, .contact-footer) .hero-button-shadow::after {
    content: '';
    position: absolute;
    top: 24px;
    left: 18px;
    width: calc(100% - 36px);
    height: calc(100% - 36px);
    padding: 2px;
    border-radius: 999px;
    background: linear-gradient(180deg, #00000038, #0000001a);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    transition: top .4s cubic-bezier(.25, 1, .5, 1),
        opacity .4s cubic-bezier(.25, 1, .5, 1);
}

@media (hover: hover) and (pointer: fine) {
:is(.portfolio-page, .about-page, .contact-footer) :is(.hero-button-wrap, .glass-hover-target):hover .hero-glass-button {
        box-shadow: inset 0 2px 2px #0000000d,
            inset 0 -2px 2px #ffffff80,
            0 2.4px .8px -1.6px #00000040,
            inset 0 0 .8px 1.6px #ffffff80,
            0 0 0 0 #fff;
        -webkit-backdrop-filter: blur(.16px);
        backdrop-filter: blur(.16px);
    }

:is(.portfolio-page, .about-page, .contact-footer) :is(.hero-button-wrap, .glass-hover-target):hover .hero-glass-button::after {
        --button-edge-angle: -125deg;
    }

:is(.portfolio-page, .about-page, .contact-footer) :is(.hero-button-wrap, .glass-hover-target):hover .hero-button-content::after {
        background-position: 25% 50%;
    }

:is(.portfolio-page, .about-page, .contact-footer) :is(.hero-button-wrap, .glass-hover-target):hover .hero-button-shadow::after {
        top: 18px;
    }
}

:is(.portfolio-page, .about-page, .contact-footer) :is(.hero-button-wrap .hero-glass-button:active, .glass-hover-target:active .hero-glass-button) {
    transform: scale(.95);
    transition-duration: .12s, .4s, .4s;
    transition-timing-function: cubic-bezier(.25, 1, .5, 1);
    box-shadow: inset 0 2px 2px #0000000d,
        inset 0 -2px 2px #ffffff80,
        0 2px 2px -2px #0003,
        inset 0 0 1.6px 4px #fff3,
        0 3.6px .8px #0000000d,
        0 4px 0 #ffffffbf,
        inset 0 4px .8px #00000026;
}

:is(.portfolio-page, .about-page, .contact-footer) :is(.hero-button-wrap .hero-glass-button:active, .glass-hover-target:active .hero-glass-button) .hero-button-content::after {
    --hero-reflection-angle: -15deg;
    background-position: 50% 15%;
}

:is(.portfolio-page, .about-page, .contact-footer) :is(.hero-button-wrap .hero-glass-button:active, .glass-hover-target:active .hero-glass-button) + .hero-button-shadow::after {
    top: 24px;
    opacity: .75;
}

:is(.portfolio-page, .about-page, .contact-footer) .hero-glass-button:focus-visible {
    outline: 2px solid #1c66ff;
    outline-offset: 5px;
}

@media (max-width: 480px) {
:is(.portfolio-page, .about-page, .contact-footer) .hero-button-wrap {
        font-size: 14px;
    }

:is(.portfolio-page, .about-page, .contact-footer) .hero-button-content {
        gap: 8px;
        padding-inline: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
:is(.portfolio-page, .about-page, .contact-footer) .hero-glass-button,
:is(.portfolio-page, .about-page, .contact-footer) .hero-glass-button::after,
:is(.portfolio-page, .about-page, .contact-footer) .hero-button-content::after,
:is(.portfolio-page, .about-page, .contact-footer) .hero-button-shadow::after {
        transition: none;
    }

:is(.portfolio-page, .about-page, .contact-footer) :is(.hero-button-wrap .hero-glass-button:active, .glass-hover-target:active .hero-glass-button) {
        transform: none;
    }
}
