:root {
    --off-white: #F8F9FA;
    --ocean: hsl(181, 100%, 45%);
    --lime:	#32CD32;
    --coral: #FF7F50;
    --sunset: #FFD700;
    --graphite: #2C3E50;
    --glass: rgba(255, 255, 255, .2);
    font-family: "Montserrat", sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
}
html {
    scrollbar-color: #6e8ffb transparent; 
    scrollbar-width: none;
    scroll-behavior: smooth;
}
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(44, 62, 80, 0.2);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(44, 62, 80, 0.5);
}

body {
    position: absolute;
    box-sizing: border-box;
    margin: 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--ocean);
    overflow-x: hidden;
}
h1, h2, h3 {
    font-weight: 300;
    letter-spacing: .25rem;
}

h4 {
    font-weight: 400;
    text-decoration: underline;
    margin-bottom: .5rem;
}

header {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    width: 100vw;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
    padding: 2.5rem 0;
    text-align: center;
    overflow: hidden;
    z-index: 100;
    filter: drop-shadow(0px 1px 6px var(--coral));
}
header::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: -40%;
    width: 170%;
    height: 110%;
    background: linear-gradient(135deg, #546ec2, #9b48ff);
    transform-origin: 70% bottom;
    opacity: .4;
    backdrop-filter: blur(3px);
    z-index: 101;
    animation: header-rotate-before 4s ease-in-out infinite alternate;
}
header::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: -40%;
    width: 170%;
    height: 110%;
    background: black;
    transform-origin: 30% center;
    opacity: .08;
    backdrop-filter: blur(3px);
    z-index: 102;
    animation: header-rotate-after 6s ease-in-out infinite alternate;
}
@supports (animation-timeline: scroll()) {
    header {
        animation: shrink-header linear both;
        animation-timeline: scroll();
        animation-range: 0px 300px;
    }
    nav {
        animation: scroll-nav linear both;
        animation-timeline: scroll();
        animation-range: 0px 300px;
    }
}
@keyframes shrink-header {
    from {
        padding: 2.5rem 0;
    }
    to {
        padding: .25rem 0;
        filter: drop-shadow(0px 4px 10px rgba(0,0,0,0.3));
    }
}
@keyframes scroll-nav {
    from {
        top: 8rem;
    }
    to {
        top: 5rem;
    }
}
@keyframes header-rotate-before {
    0% {
        transform: rotate(0deg) translateX(-10%);
    }
    100% {
        transform: rotate(3deg) translateX(10%);
    }
}

@keyframes header-rotate-after {
    0% {
        transform: rotate(-3deg) translateX(10%);
    }
    100% {
        transform: rotate(0deg) translateX(-10%);
    }
}
h1 {
    font-size: 3rem;
    font-weight: 200;
    letter-spacing: .5rem;
    margin: 1rem 0;
    padding: 0;
}

.glass {
    border-radius: 1rem;
    background-color: rgba(132, 160, 177, 0.25);
    backdrop-filter: blur(1.5px);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.25),
        0 1px 2px rgba(0,0,0,0.12), 
        0 6px 12px rgba(0,0,0,0.25);
    border: 1px solid rgba(0,0,0,0.08);
}

nav {
    position: sticky;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 96%;
    padding: 1rem 0;
    z-index: 800;
    perspective: 1000px;
}
.search-field {
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    border-radius: 1rem;
    gap: 1rem;
    padding: .75rem 3rem;
    position: relative;
    background-color: rgba(132, 160, 177, 0.25);
    backdrop-filter: blur(2px);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.25),
        0 1px 3px rgba(0,0,0,0.12), 
        0 8px 24px rgba(0,0,0,0.25);
    border: 1px solid rgba(0,0,0,0.08);
    transition: transform 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.7s ease;
}
.search-field:hover {
    transform: rotateY(1deg);
    box-shadow: 
        inset 1px 1px 1px rgba(255, 255, 255, 0.25),
        -3px 1px 3px rgba(0,0,0,0.11),
        -8px 8px 32px rgba(0,0,0,0.25);
}
.search-field::before {
    content: "";
    position: absolute;
    top: 0;
    left: -150%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        to right, 
        rgba(255, 255, 255, 0) 0%, 
        rgba(255, 255, 255, 0.2) 50%, 
        rgba(255, 255, 255, 0) 100%
    );
    transform: skewX(-40deg);
    transition: 0.7s;
}
.search-field:hover::before {
    left: 150%;
}

.radio-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--off-white);
    border-radius: .5rem;
    overflow: hidden;
}
.radio-group {
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 120px;
    max-width: 50%;
    overflow: hidden;
    transition: background-color .2s;
}
input[type="radio"] {
    display: none;
}
.radio-group:has(input[type="radio"]:checked) {
    background-color: var(--sunset);
}
.radio-group label {
    display: flex;
    align-self: center;
    justify-self: center;
    cursor: pointer;
    flex: 1;
    padding: .5rem 0;
    transition: background-color .1s;
}
label i {
    align-self: center;
    margin: 0 .5rem;
}
label span {
    margin-right: 1rem;
}


.input-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}
input[type="text"] {
    background-color: var(--off-white);
    color: var(--graphite);
    padding: .5rem 1rem;
    border-radius: .5rem;
    outline: none;
    border: 1px solid transparent;
    width: 100%;
    flex-grow: 1;
    min-width: 0;
    max-width: 100%;
    transition: border-radius .2s linear;
}
input[type="text"]:focus {
    border: 1px solid var(--sunset);
}
label {
    letter-spacing: normal;
    font-size: .75rem;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
    cursor: pointer;
}
button {
    font-family: "Montserrat", sans-serif;
    background-color: var(--off-white);
    color: var(--graphite);
    padding: .5rem 1.5rem;
    border: none;
    outline: none;
    border-radius: .5rem;
    cursor: pointer;
    transition: transform .1s linear;
}
button:hover {
    transform: translateY(1px);
}


main {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    width: min(1200px, 96%);
    padding: 2rem 1rem;
    z-index: 1;
}
.introduce {
    flex: 1 0 100%;
}
.introduce h2 {
    margin-top: 0;
}

#drink-container {
    display: none;
    width: 100%;
    padding: 2rem 2rem;
    justify-items: center;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.drink-card {
    position: relative;
    display: flex;
    flex-flow: row wrap;
    justify-content: center;
    color: var(--off-white);
    max-height: 33vh;
    border-radius: 1rem;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5));
    aspect-ratio: 1 / 1;
    overflow: hidden;
    transition: transform .2s linear, filter .2s linear;
}
.drink-card:hover {
    transform: translateY(-2px);
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.7));
    cursor: pointer;
}
.drink-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 1rem;
    transition: transform .4s ease-in-out;
}
.drink-card:hover img {
    transform: scale(1.1);
}
.drink-card h3 {
    position: absolute;
    bottom: 0;
    width: 100%;
    margin: 0;
    padding: .5rem 0;
    text-align: center;
    background: linear-gradient(180deg, transparent, rgba(0,0,0,0.8));
    z-index: 5;
}
.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    color: var(--ocean);
    cursor: pointer;
    z-index: 10;
}

.to-top {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    right: 2rem;
    bottom: 2rem;
    width: 2rem;
    height: 2rem;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: scale .2s linear, opacity 0.4s ease-in-out, transform 0.4s;
}
.to-top:hover {
    scale: 1.3;
}
.to-top a {
    flex: 1;
    padding: .5rem 0;
    text-decoration: none;
    color: var(--off-white);
}
.to-top.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-overlay, .loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--off-white);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
.drink-modal {
    display: flex;
    flex-flow: row wrap;
    gap: 1rem 2rem;
    width: clamp(60%, 500px, 96vw);
    border-radius: 2rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    background-color: var(--graphite);
    color: var(--ocean);
    padding: 2rem 2rem;
    z-index: 1000;
    overflow-y: auto;
    scrollbar-gutter: stable;
    max-height: 96dvh;
}
.drink-modal h2 {
    text-align: center;
    font-size: 2rem;
    margin: 0 0 .5rem 0 ;
    flex: 1 0 100%;
}
.plus-18 {
    position: absolute;
    top: 1rem;
    right: 1rem;
    height: 2rem;
    width: 2rem;
    background-color: rgb(255, 69, 69);
    border-radius: 50% 3px 50% 50%;
    border: 1px solid rgba(0,0,0,0.15);
}
.plus-18 img {
    height: 100%;
    width: 100%;
}
.drink-image {
    position: relative;
    align-self: first baseline;
    justify-self: center;
    margin: 0 auto;
    aspect-ratio: 1 / 1;
    border-radius: 1rem;
    overflow: hidden;
}
.drink-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.card-text {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    flex: 1 1 300px;
}
.card-text h3 {
    margin-top: 0;
}
.ingredients {
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 1rem;
    padding: 1rem;
    width: auto;
}

.ingredients ul {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));;
    place-items: center;
    gap: 1rem;
    width: 100%;
    list-style: none;
    padding-left: 0;
    margin: 0;
}
.ingredients li {
    display: flex;
    width: fit-content;
    flex-flow: column nowrap;
    justify-content: center;
    align-items: center;
    gap: .5rem;
}
.ingredients li img {
    width: 4rem;
    height: 4rem;
    object-fit: contain;
}
.ingredients li > div {
    display: flex;
    gap: .5rem;
    text-wrap: wrap;
}
.measure {
    text-wrap: nowrap;
    text-align: right;
}
.instructions {
    flex: 1;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 1rem;
    padding: 1rem;
}

#scroll-anchor {
    display: flex;
    justify-content: center;
    padding: 20px;
    width: 100%;
}
.mini-loader {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 20px;
    font-size: 0.9rem;
    color: #666;
    padding: 20px;
}
.spinner-dot {
    position: relative;
    width: 8px;
    height: 8px;
    background-color: #666;
    border-radius: 50%;
    animation: bounce 0.6s infinite alternate;
    animation-delay: 0.2s;
}
.spinner-dot:before,
.spinner-dot:after {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #666;
    border-radius: 50%;
    animation: bounce 0.6s infinite alternate;
}
.spinner-dot:before {
    left: -12px;
    animation-delay: 0s;
}
.spinner-dot:after {
    left: 12px;
    animation-delay: 0.4s;
}
@keyframes bounce {
    from {
        transform: translateY(5px);
    }
    to {
        transform: translateY(-5px);
    }
}

footer {
    width: 100%;
    padding: 3rem 0;
    text-align: center;
    letter-spacing: .25rem;
    background-color: rgba(44, 62, 80, .1);
    backdrop-filter: blur(1.5px);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.25),
        0 1px 3px rgba(0,0,0,0.12), 
        0 8px 24px rgba(0,0,0,0.25);
    border: 1px solid rgba(0,0,0,0.08);
}

@media screen and (max-width: 768px) {
    main {
        padding: 1rem .5rem;
    }
    header {
        padding: .5rem 0;
    }
    h1 {
        font-size: 1.8rem;
        letter-spacing: .15rem;
    }
    nav {
        z-index: 33;
    }
    .search-field {
        flex-flow: row wrap;
        box-sizing: border-box;
        width: 96vw;
        padding: 1rem;
        flex: 1;
    }
    .radio-wrapper {
        display: none;
        justify-content: center;
        width: 6rem;
        height: 3rem;
        order: 2;
    }
    .radio-group {
        min-width: 10px;
    }
    .radio-group label {
        flex: 0;
        width: 3rem;
    }
    .radio-group label span{
        display: none;
    }
    .radio-group i {
        padding: 1rem;
        margin: 0;
    }
    #search-btn {
        order: 3;
        height: 3rem;
        flex: 1;
        display: none;
    }

    .input-group {
        order: 1;
        display: flex;
        width: 100%;
    }
    .input-group input[type="text"] {
        font-size: 1rem;
        padding: .75rem 1rem;
    }
    .search-field.is-active #search-btn {
        display: block;
    }
    .search-field.is-active .radio-wrapper {
        display: flex;
    }

    button {
        padding: .75rem 1.5rem;
        font-size: 1rem;
        width: 100%;
    }
    #drink-container {
        padding: 1rem;
        gap: 1.5rem;
        align-items: first baseline;
        justify-items: center;
    }
    .drink-card {
        width: 100%;
        height: 100%;
    }
    header, nav {
        animation: none !important;
    }
    nav {
        position: static;
        max-width: 96%;
    }
    .to-top a {
        right: 1.5rem;
        bottom: 1.5rem;
    }
    ul {
        padding-left: 1rem;
    }
    .drink-modal {
        width: 90%;
        padding: 1rem;
    }

    footer {
        padding: 2rem 0;
        letter-spacing: .1rem;
        font-size: 0.8rem;
    }
}