:root {
    color-scheme: light;
    --ink: #263a30;
    --muted: #65756a;
    --leaf: #385e46;
    --leaf-dark: #294735;
    --accent: #c97745;
    --paper: #fffdf8;
    --canvas: #f3f1e8;
    --line: #e6e5d8;
}

body {
    margin: 0;
    padding: clamp(16px, 4vw, 40px);
    min-height: 100vh;
    box-sizing: border-box;
    display: grid;
    place-items: center;
    background:
        radial-gradient(ellipse at 12% 8%, rgb(222 230 207 / 78%), transparent 34rem),
        radial-gradient(ellipse at 88% 88%, rgb(238 215 188 / 72%), transparent 36rem),
        var(--canvas);
    color: var(--ink);
    font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
}

.form {
    width: min(100%, 420px);
    padding: clamp(24px, 5vw, 44px);
    box-sizing: border-box;
    border: 1px solid rgb(255 255 255 / 80%);
    border-radius: 28px;
    background: var(--paper);
    box-shadow: 0 24px 70px rgb(54 65 47 / 12%);
}

h2 {
    margin: 0 0 24px;
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.7rem, 4vw, 2.25rem);
    line-height: 1.15;
    text-align: center;
}

.category-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.category-buttons button {
    width: 100%;
    min-height: 56px;
    padding: 14px 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    color: var(--leaf-dark);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 3px 10px rgb(54 65 47 / 5%);
    transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.category-buttons button:hover,
.category-buttons button[aria-expanded="true"] {
    transform: translateY(-3px);
    border-color: #9eaf93;
    background: #f0f3e9;
    box-shadow: 0 8px 20px rgb(54 65 47 / 10%);
}

.category-buttons button:active {
    transform: translateY(-1px) scale(0.99);
    box-shadow: 0 3px 8px rgb(54 65 47 / 8%);
}

.category-buttons button:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

.dinner-picker {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.dinner-picker button {
    width: 100%;
    min-height: 58px;
    padding: 16px 20px;
    border: 0;
    border-radius: 14px;
    background: var(--leaf);
    color: white;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 18px rgb(56 94 70 / 20%);
    transition: background-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.dinner-picker button:hover {
    transform: translateY(-2px);
    background: var(--leaf-dark);
    box-shadow: 0 12px 24px rgb(56 94 70 / 24%);
}

.dinner-picker button:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

#dinner-result {
    margin: 0;
    color: var(--leaf-dark);
    font-weight: 700;
    text-align: center;
    line-height: 1.5;
}

body.showing-recipes {
    place-items: start center;
}

.form.showing-recipes {
    width: min(100%, 1160px);
    margin-block: 12px;
    padding: clamp(20px, 4vw, 48px);
    border-radius: 32px;
}

.form.showing-recipes .category-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 44px;
}

.recipe-section[hidden] {
    display: none;
}

.recipe-section h2 {
    margin-bottom: 24px;
    text-align: left;
}

.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 245px), 1fr));
    gap: 22px;
}

.recipe-card {
    position: relative;
    overflow: hidden;
    border: 1px solid rgb(230 229 216 / 85%);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 5px 16px rgb(54 65 47 / 5%);
    transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

.recipe-card:hover {
    transform: translateY(-5px);
    border-color: #c7d0bc;
    box-shadow: 0 16px 32px rgb(54 65 47 / 12%);
}

.recipe-card::after {
    position: absolute;
    right: 16px;
    bottom: 16px;
    padding: 8px 11px;
    border-radius: 999px;
    background: #f0f3e9;
    color: var(--leaf-dark);
    content: "View recipe  ↗";
    font-size: 0.76rem;
    font-weight: 700;
    pointer-events: none;
}

.recipe-card.tonight-pick {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgb(201 119 69 / 18%), 0 16px 32px rgb(54 65 47 / 12%);
}

.recipe-card img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: transform 350ms ease;
}

.recipe-card:hover img {
    transform: scale(1.04);
}

.recipe-card h3,
.recipe-card p {
    margin-inline: 20px;
}

.recipe-card h3 {
    margin-top: 18px;
    margin-bottom: 8px;
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.3rem;
    line-height: 1.25;
}

.recipe-card p {
    margin-top: 0;
    margin-bottom: 54px;
    color: var(--muted);
    line-height: 1.6;
}

.recipe-link {
    position: absolute;
    z-index: 1;
    inset: 0;
    border-radius: inherit;
}

.recipe-link:focus-visible,
.dialog-close:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

.recipe-card:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgb(201 119 69 / 18%);
}

.recipe-dialog {
    width: 100vw;
    height: 100vh;
    width: 100dvw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: var(--paper);
    color: var(--ink);
}

.recipe-dialog::backdrop {
    background: rgb(24 37 29 / 72%);
    backdrop-filter: blur(5px);
}

.dialog-close {
    position: fixed;
    z-index: 1;
    top: 22px;
    right: 26px;
    display: grid;
    width: 50px;
    height: 50px;
    place-items: center;
    border: 1px solid rgb(38 58 48 / 10%);
    border-radius: 50%;
    background: var(--paper);
    color: var(--ink);
    font: inherit;
    font-size: 2rem;
    line-height: 1;
    box-shadow: 0 8px 24px rgb(0 0 0 / 18%);
    cursor: pointer;
    transition: transform 180ms ease, background 180ms ease;
}

.dialog-close:hover {
    transform: rotate(90deg);
    background: #f0f3e9;
}

.dialog-content {
    display: grid;
    min-height: 100%;
    grid-template-columns: minmax(0, 1fr) minmax(380px, 0.85fr);
}

.dialog-content > img {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    object-fit: cover;
    background: var(--canvas);
}

.dialog-copy {
    align-self: start;
    max-height: 100vh;
    max-height: 100dvh;
    overflow-y: auto;
    padding: clamp(36px, 6vw, 88px);
    scrollbar-color: #c6cfbd transparent;
    scrollbar-width: thin;
}

.dialog-eyebrow {
    margin: 0 0 12px;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.dialog-copy h2 {
    margin: 0 0 16px;
    color: var(--ink);
    font-size: clamp(2rem, 5vw, 3.5rem);
    text-align: left;
}

.dialog-copy > p {
    max-width: 34rem;
    margin: 0;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.75;
}

.dialog-copy h3 {
    margin: 30px 0 12px;
    color: var(--leaf-dark);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.45rem;
}

.dialog-copy ul,
.dialog-copy ol {
    display: grid;
    gap: 10px;
    max-width: 34rem;
    margin: 0;
    padding-left: 24px;
    color: var(--muted);
    line-height: 1.7;
}

@media (max-width: 520px) {
    body {
        padding: 12px;
    }

    .form.showing-recipes {
        margin-block: 0;
        padding: 24px 18px;
        border-radius: 24px;
    }

    .form.showing-recipes > h2 {
        margin-bottom: 20px;
    }

    .form.showing-recipes .category-buttons {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 32px;
    }

    .recipe-grid {
        gap: 16px;
    }

    .recipe-card {
        border-radius: 17px;
    }

    .recipe-card h3,
    .recipe-card p {
        margin-inline: 16px;
    }

    .recipe-card::after {
        right: 12px;
        bottom: 12px;
    }

    .recipe-card p {
        margin-bottom: 50px;
    }

    .dialog-close {
        top: 14px;
        right: 14px;
        width: 46px;
        height: 46px;
    }
}

@media (max-width: 760px) {
    .dialog-content {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(30dvh, 36dvh) auto;
    }

    .dialog-content > img {
        height: 36dvh;
    }

    .dialog-copy {
        max-height: none;
        overflow: visible;
        padding: 28px 22px 40px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
