:root {
    --bg: #07131f;
    --bg-soft: #0f2336;
    --surface: rgba(17, 33, 49, 0.82);
    --surface-2: rgba(12, 25, 40, 0.92);
    --text: #f4f8fb;
    --muted: #99aec2;
    --line: rgba(190, 217, 241, 0.22);
    --primary: #ffd27f;
    --primary-2: #ff9f6e;
    --accent: #88f0d1;
    --shadow: 0 24px 80px rgba(2, 9, 17, 0.45);
}

* {
    box-sizing: border-box;
}

body {
    position: relative;
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at 12% 18%, rgba(123, 201, 255, 0.2), transparent 38%),
        radial-gradient(circle at 86% 6%, rgba(255, 202, 136, 0.22), transparent 35%),
        linear-gradient(160deg, #04101b 0%, #0a1d2d 42%, #0b2431 100%);
    font-family: 'Outfit', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
}

body {
    cursor: auto;
}

@media (pointer: fine) {
    body,
    a,
    button,
    [role="button"],
    .recipe-card,
    .chip,
    .close-btn,
    .surprise-btn,
    .nav-btn,
    #searchBtn,
    input,
    textarea,
    select,
    label {
        cursor: none;
    }

    .custom-cursor,
    .custom-cursor-dot {
        position: fixed;
        left: 0;
        top: 0;
        pointer-events: none;
        opacity: 0;
        z-index: 10000;
        transform: translate(-50%, -50%);
        transition: opacity 0.18s ease;
    }

    .custom-cursor {
        width: 36px;
        height: 36px;
        border: 2px solid rgba(247, 251, 255, 0.94);
        border-radius: 50%;
        background: radial-gradient(circle, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.03));
        box-shadow: 0 0 0 1px rgba(8, 16, 26, 0.45), 0 10px 24px rgba(0, 0, 0, 0.28);
        transition: width 0.2s ease, height 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, opacity 0.18s ease;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .custom-cursor::before {
        content: "";
        color: #ffffff;
        font-weight: 700;
        font-size: 17px;
        line-height: 1;
        opacity: 0;
        transform: translateY(-2px);
        text-shadow: 0 0 10px rgba(4, 9, 15, 0.8);
        transition: opacity 0.14s ease;
    }

    .custom-cursor-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #ffd27f;
        box-shadow: 0 0 0 5px rgba(255, 210, 127, 0.2), 0 0 16px rgba(255, 210, 127, 0.68);
        transition: transform 0.16s ease, background 0.16s ease, opacity 0.18s ease;
    }

    body.cursor-ready .custom-cursor,
    body.cursor-ready .custom-cursor-dot {
        opacity: 1;
    }

    body.cursor-hover .custom-cursor {
        width: 50px;
        height: 50px;
        border-color: rgba(255, 210, 127, 0.95);
        background: radial-gradient(circle, rgba(255, 210, 127, 0.26), rgba(255, 210, 127, 0.05));
        box-shadow: 0 0 0 1px rgba(19, 11, 4, 0.42), 0 14px 30px rgba(255, 166, 87, 0.3);
    }

    body.cursor-hover .custom-cursor-dot {
        transform: translate(-50%, -50%) scale(1.5);
        background: #fff2d8;
    }

    body.scroll-down .custom-cursor {
        border-color: rgba(136, 240, 209, 0.98);
    }

    body.scroll-down .custom-cursor::before {
        content: "↓";
        opacity: 1;
    }

    body.scroll-up .custom-cursor {
        border-color: rgba(179, 216, 255, 0.98);
    }

    body.scroll-up .custom-cursor::before {
        content: "↑";
        opacity: 1;
    }
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 0);
    background-size: 24px 24px;
    opacity: 0.3;
    z-index: -2;
}

body::after {
    content: "";
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 260px;
    pointer-events: none;
    transform: translate(calc(var(--mx, 50vw) - 130px), calc(var(--my, 50vh) - 130px));
    background: radial-gradient(circle, rgba(132, 207, 255, 0.13), rgba(132, 207, 255, 0));
    filter: blur(8px);
    z-index: -1;
    transition: transform 0.12s linear;
}

.bg-glow {
    position: fixed;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    filter: blur(62px);
    pointer-events: none;
    z-index: -1;
    animation: drift 12s ease-in-out infinite alternate;
}

.bg-glow-one {
    top: -120px;
    left: -110px;
    background: rgba(96, 194, 255, 0.22);
}

.bg-glow-two {
    right: -100px;
    bottom: -120px;
    background: rgba(255, 169, 118, 0.22);
    animation-delay: 1.4s;
}

@keyframes drift {
    from {
        transform: translateY(-8px) scale(1);
    }
    to {
        transform: translateY(12px) scale(1.07);
    }
}

.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 18px 6%;
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
    background: rgba(5, 16, 27, 0.76);
}

.navbar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 210, 127, 0.75), transparent);
    opacity: 0.6;
}

.logo {
    font-family: 'Playfair Display', serif;
    font-size: 2.05rem;
    font-weight: 800;
    letter-spacing: 0.4px;
}

.logo span {
    color: var(--primary);
    text-shadow: 0 0 20px rgba(255, 174, 104, 0.45);
}

.cuisine-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

button {
    font-family: inherit;
}

.nav-btn,
.surprise-btn,
.chip,
#searchBtn {
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.22s ease, box-shadow 0.24s ease, border-color 0.24s ease, background 0.24s ease, color 0.24s ease;
}

.nav-btn {
    padding: 10px 16px;
    font-size: 0.92rem;
    color: #dce9f5;
    border-color: rgba(194, 223, 249, 0.2);
    background: linear-gradient(135deg, rgba(30, 52, 75, 0.68), rgba(16, 37, 59, 0.64));
}

.nav-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 210, 127, 0.72);
    color: #fff;
    box-shadow: 0 8px 24px rgba(8, 18, 29, 0.45);
}

.nav-btn.is-active {
    border-color: rgba(136, 240, 209, 0.84);
    box-shadow: 0 0 0 1px rgba(136, 240, 209, 0.35) inset, 0 10px 24px rgba(8, 18, 29, 0.5);
    color: #ffffff;
}

.surprise-btn {
    padding: 10px 17px;
    font-weight: 700;
    color: #1c1206;
    border-color: rgba(255, 217, 146, 0.82);
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 12px 28px rgba(255, 158, 96, 0.24);
    position: relative;
    overflow: hidden;
}

.surprise-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-130%);
    background: linear-gradient(105deg, transparent 28%, rgba(255, 255, 255, 0.44) 50%, transparent 72%);
    animation: btn-shimmer 4.4s ease-in-out infinite;
}

.surprise-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 20px 34px rgba(255, 156, 94, 0.35);
}

.search-hero {
    padding: 76px 6% 38px;
    text-align: center;
    animation: rise-in 0.8s ease both;
}

.hero-kicker {
    margin: 0;
    color: var(--accent);
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.search-hero h1 {
    margin: 12px auto 10px;
    max-width: 820px;
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 4vw, 3.45rem);
    line-height: 1.1;
}

.hero-subtitle {
    margin: 0 auto 26px;
    max-width: 700px;
    color: var(--muted);
    font-size: 1.02rem;
}

.search-container {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: min(740px, 100%);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px;
    background: linear-gradient(140deg, rgba(19, 40, 60, 0.82), rgba(9, 24, 38, 0.72));
    box-shadow: var(--shadow);
}

.search-container input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font-size: 1.02rem;
    padding: 12px 18px;
}

.search-container input::placeholder {
    color: #95a9bc;
}

#searchBtn {
    padding: 12px 24px;
    font-weight: 700;
    color: #1e1509;
    background: linear-gradient(135deg, var(--primary), #ffc994);
    border-color: rgba(255, 210, 127, 0.86);
    white-space: nowrap;
}

#searchBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(255, 170, 105, 0.3);
}

.filter-chips {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 0 6%;
    margin-bottom: 40px;
    animation: rise-in 0.95s ease both;
}

.chip {
    padding: 10px 18px;
    font-size: 0.9rem;
    color: #d9e7f4;
    border-color: rgba(178, 214, 241, 0.28);
    background: linear-gradient(140deg, rgba(25, 48, 72, 0.78), rgba(14, 31, 50, 0.76));
}

.chip:hover {
    transform: translateY(-3px);
    color: #fff;
    border-color: rgba(255, 212, 134, 0.84);
    box-shadow: 0 14px 28px rgba(6, 18, 30, 0.52);
}

.chip.is-active {
    border-color: rgba(255, 214, 139, 0.9);
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(6, 18, 30, 0.5), 0 0 0 1px rgba(255, 214, 139, 0.32) inset;
}

.container {
    padding-bottom: 80px;
}

.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 28px;
    padding: 0 6%;
}

.loader {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--muted);
    font-size: 1.04rem;
    padding: 32px 0;
}

.recipe-card {
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    border: 1px solid rgba(191, 217, 241, 0.22);
    background: linear-gradient(155deg, rgba(20, 39, 59, 0.94), rgba(11, 25, 40, 0.96));
    box-shadow: 0 22px 44px rgba(3, 10, 18, 0.38);
    transition: transform 0.34s ease, box-shadow 0.34s ease, border-color 0.34s ease;
    animation: rise-in 0.6s ease both;
    transform-style: preserve-3d;
    will-change: transform;
}

.recipe-card:hover {
    transform: translateY(-8px);
    border-color: rgba(255, 209, 133, 0.86);
    box-shadow: 0 28px 54px rgba(2, 10, 18, 0.5);
}

.recipe-card img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    filter: saturate(1.02) contrast(1.05);
}

.recipe-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(125deg, rgba(255, 255, 255, 0.08), transparent 45%);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.recipe-card:hover::after {
    opacity: 1;
}

.recipe-info {
    padding: 22px;
    text-align: center;
}

.recipe-title {
    margin: 0 0 8px;
    font-size: 1.42rem;
    line-height: 1.22;
    font-family: 'Playfair Display', serif;
}

.recipe-cta {
    color: var(--primary);
    font-weight: 700;
    letter-spacing: 0.03em;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    overflow-y: auto;
    background: rgba(4, 12, 20, 0.78);
    backdrop-filter: blur(8px);
    animation: fade-in 0.25s ease;
}

.modal-content {
    position: relative;
    width: min(980px, 92%);
    margin: 34px auto;
    padding: 40px;
    border-radius: 28px;
    border: 1px solid rgba(194, 220, 243, 0.22);
    background: linear-gradient(160deg, rgba(16, 33, 52, 0.95), rgba(8, 22, 35, 0.97));
    box-shadow: 0 32px 90px rgba(3, 11, 19, 0.6);
    animation: modal-rise 0.32s ease;
}

.reveal-item {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
    transition: opacity 0.56s ease, transform 0.56s ease;
    transition-delay: var(--reveal-delay, 0ms);
}

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

.scroll-progress {
    position: fixed;
    left: 0;
    top: 0;
    height: 3px;
    width: 100%;
    transform-origin: left;
    transform: scaleX(var(--scroll-progress, 0));
    background: linear-gradient(90deg, var(--accent), var(--primary), var(--primary-2));
    z-index: 3000;
    box-shadow: 0 0 18px rgba(255, 166, 102, 0.5);
}

.close-btn {
    position: absolute;
    right: 24px;
    top: 12px;
    color: #d8e8f5;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

.close-btn:hover {
    color: var(--primary);
}

.modal-title {
    margin: 0 0 10px;
    font-size: clamp(2rem, 3vw, 2.6rem);
    font-family: 'Playfair Display', serif;
    color: var(--primary);
}

.modal-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    color: var(--muted);
    font-size: 0.94rem;
}

.modal-image {
    width: 100%;
    border-radius: 20px;
    margin-bottom: 28px;
    border: 1px solid rgba(196, 222, 243, 0.2);
}

.modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 34px;
}

.modal-section-title {
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 209, 133, 0.6);
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
}

.ingredients-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ingredient-item {
    padding: 7px 0;
    border-bottom: 1px solid rgba(172, 203, 229, 0.16);
    color: #d8e6f3;
}

.ingredient-dot {
    color: var(--primary);
    margin-right: 8px;
}

.instructions {
    margin: 0;
    color: #d4e4f2;
    line-height: 1.8;
    white-space: pre-line;
}

.video-wrapper {
    position: relative;
    height: 0;
    padding-bottom: 56.25%;
    margin-top: 24px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(186, 215, 239, 0.25);
}

.video-wrapper iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes btn-shimmer {
    0%,
    62% {
        transform: translateX(-130%);
    }
    100% {
        transform: translateX(130%);
    }
}

@keyframes modal-rise {
    from {
        transform: translateY(22px) scale(0.98);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@media (max-width: 900px) {
    .navbar {
        padding: 14px 5%;
        align-items: flex-start;
        flex-direction: column;
    }

    .cuisine-nav {
        justify-content: flex-start;
    }

    .search-hero {
        padding-top: 56px;
    }
}

@media (max-width: 640px) {
    .search-container {
        flex-direction: column;
        border-radius: 24px;
        padding: 10px;
    }

    .search-container input {
        padding: 12px 10px;
    }

    #searchBtn {
        width: 100%;
    }

    .modal-content {
        padding: 32px 22px;
    }
}

@media (pointer: coarse) {
    body::after {
        display: none;
    }
}