*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    overflow-x: hidden;
}

:root {
    --primary-font: 'Montserrat', sans-serif;
    --secondary-font: 'Poppins', serif;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

html {
    font-size: 62.5%;
}

/* Recipe Finder Section */

.recipe__finder {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 6rem 0;
    min-height: 100vh;
    background: var(--gradient-primary);
    overflow: hidden;
}

@media screen and (min-width: 375px) and (max-width: 600px) {
    .recipe__finder {
        text-align: center;
    }
}

@media screen and (min-width: 600px) and (max-width: 768px) {
    .recipe__finder {
        text-align: center;
    }
}

.recipe__title-name {
    font-family: var(--primary-font);
    text-transform: uppercase;
    font-size: 7rem;
    color: white;
    font-weight: 800;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    margin-bottom: 0.5rem;
}

@media screen and (min-width: 375px) and (max-width: 600px) {
    .recipe__title-name {
        font-size: 4rem;
        margin-bottom: 0;
    }
}

@media screen and (min-width: 600px) and (max-width: 768px) {
    .recipe__title-name {
        font-size: 5.5rem;
        margin-bottom: 0.3rem;
    }
}

.recipe__text {
    font-family: var(--secondary-font);
    font-size: 2.1rem;
    padding: 1rem 0 3rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    max-width: 600px;
    line-height: 1.6;
}

@media screen and (min-width: 375px) and (max-width: 600px) {
    .recipe__text {
        font-size: 1.6rem;
        padding-bottom: 0;
        margin-bottom: 2.5rem;
    }
}

@media screen and (min-width: 600px) and (max-width: 768px) {
    .recipe__text {
        font-size: 1.8rem;
        padding-bottom: 0.5rem 0 1.5rem;
        margin-bottom: 0.5rem;
    }
}

/* Search Section */

.recipe__search {
    display: flex;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    max-width: 700px;
    padding: 0 2rem;
    margin-bottom: 3rem;
}

.recipe__search-box {
    font-family: var(--secondary-font);
    padding: 1.5rem;
    font-size: 1.5rem;
    border-radius: 12px;
    border: none;
    flex: 1;
    min-width: 250px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

@media screen and (min-width: 375px) and (max-width: 600px) {
    .recipe__search-box {
        padding: 1rem;
        font-size: 1.3rem;
    }
}

.recipe__search-box:focus {
    outline: none;
    background: white;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.recipe__search-box::placeholder {
    color: #999;
}

/* Search Buttons */

.recipe__search-btn,
.recipe__random-btn {
    font-family: var(--primary-font);
    padding: 1.5rem 2.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.recipe__search-btn {
    background: var(--gradient-secondary);
    color: white;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.recipe__search-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(245, 87, 108, 0.4);
}

@media screen and (min-width: 375px) and (max-width: 600px) {
    .recipe__search-btn {
        padding: 1.3rem;
        font-size: 1.3rem;
    }
}

.recipe__random {
    display: flex;
    justify-content: center;
    animation: slideUp 0.8s ease-out 0.4s backwards;
}

.recipe__random-btn {
    background: white;
    color: #764ba2;
    margin-top: 0.5rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

@media screen and (min-width: 375px) and (max-width: 600px) {
    .recipe__random-btn {
        padding: 1.3rem;
        font-size: 1.3rem;
        margin-top: 0;
    }
}

.recipe__random-btn:hover {
    background: var(--gradient-secondary);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(245, 87, 108, 0.4);
}

.recipe__search-btn:active,
.recipe__random-btn:active {
    transform: translateY(-1px);
}

/* Recipe Container Section */

.recipe__container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

@media (min-width: 640px) {
    .recipe__container {
        grid-template-columns: repeat(2, 1fr);
        gap: 2.5rem;
    }
}

@media (min-width: 1024px) {
    .recipe__container {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
}

.random-recipe-wrapper {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
}

.random-recipe-wrapper .recipe__random-card {
    max-width: 450px;
    width: 100%;
}

.recipe__container-card,
.recipe__random-card {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease-in-out;
}

.recipe__container-card:hover,
.recipe__random-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.recipe__container-card h2,
.recipe__random-card h2 {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.8rem, 2.5vw, 2.4rem);
    font-family: var(--primary-font);
    text-transform: uppercase;
    text-align: center;
    padding: 2rem 1.5rem;
    color: white;
    line-height: 1.3;
    background: rgba(0, 0, 0, 0.2);
    min-height: fit-content;
}

.recipe__container-card img,
.recipe__random-card img {
    display: block;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    height: 100%;
    min-height: 250px;
    object-fit: cover;
}

@media (min-width: 640px) {
    .recipe__container-card img,
    .recipe__random-card img {
        min-height: 300px;
    }
}

.recipe__container-card img:hover,
.recipe__random-card img:hover {
    transform: scale(1.05);
}


/* Recipe Ingredients Section */

.ingredients__container {
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 15px;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    transition: opacity 0.3s ease, visibility 0s, backdrop-filter 0.3s ease;
}

.ingredients__container.hidden {
    opacity: 0;
    visibility: hidden;
    backdrop-filter: blur(0);
    transition-delay: 0s, 0.3s, 0s;
}

.ingredients__list {
    display: flex;
    flex-direction: column;
    background-color: #6b65c3;
    max-width: 900px;
    max-height: 75vh;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    overflow: hidden;
    padding: 65px 75px;
    position: relative;
    transition: transform 0.3s ease;
}

.ingredients__container.hidden .ingredients__list {
    transform: scale(0.95);
}

/* Exit Button */

.ingredients__exit-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 1.5rem;
    color: black;
    background-color: white;
    border: 1.5px solid black;
    border-radius: 10px;
    padding: 7px;
}


.ingredients__exit-btn:hover {
    color: red;
    background-color: #efefef;
    cursor: pointer;
}

/* Ingredient Details Section */

.ingredients__details {
    overflow-y: scroll;
    overflow-x: hidden;
    scrollbar-gutter: auto;
    flex: 1;
    padding-right: 25px;
}

.ingredients__details h2 {
    font-size: 3rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: white;
    font-family: var(--secondary-font);
    text-transform: uppercase;
}

.ingredients__details img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    aspect-ratio: 16/9;
    object-fit: cover;
}

.ingredients__details h3 {
    font-size: 3rem;
    font-weight: 500;
    margin-top: 25px;
    margin-bottom: 10px;
    border-bottom: 1.5px solid #d7d4d4;
    font-family: var(--secondary-font);
    text-transform: uppercase;
    color: white;
}

.ingredients__details ul {
    list-style: none;
    padding: 0;
    margin-bottom: 25px;
}

.ingredients__details ul li {
    padding: 8px 0;
    border-bottom: 1px dashed lightgray;
    font-size: 2rem;
    font-family: var(--secondary-font);
    color: white;
}

.ingredients__details ul li:last-child {
    border-bottom: none;
}

.ingredients__details p {
    line-height: 1.8;
    font-size: 2rem;
    font-family: var(--secondary-font);
    color: white;
}

.ingredients__details a {
    color: black;
    text-decoration: none;
    font-weight: 600;
}

.ingredients__details a:hover {
    color: green;
    text-decoration: underline;
}