:root {
    --bg-start: #f6f0e8;
    --bg-end: #ece4d8;
    --card-bg: rgba(255, 250, 243, 0.95);
    --text-main: #2b2018;
    --text-muted: #66584f;
    --accent: #8f3b2e;
    --accent-strong: #722b21;
    --accent-soft: #f2ddd0;
    --shadow: 0 18px 55px rgba(72, 40, 24, 0.18);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    color: var(--text-main);
    background:
        radial-gradient(circle at 5% 10%, rgba(255, 255, 255, 0.75) 0, rgba(255, 255, 255, 0) 28%),
        radial-gradient(circle at 92% 84%, rgba(196, 131, 99, 0.2) 0, rgba(196, 131, 99, 0) 30%),
        linear-gradient(145deg, var(--bg-start), var(--bg-end));
    display: grid;
    place-items: center;
    padding: 3.5rem 1rem;
    position: relative;
    overflow-x: hidden;
}

/* HOME PAGE STYLING - ORIGINAL (easily revertable) */
/* body.home-page { padding-top: 2.2rem; }
   body.home-page header { margin-bottom: 0.55rem; }
   header { font-size: clamp(1.6rem, 3.5vw, 2.5rem); }
   header p { font-size: clamp(1rem, 2vw, 1.1rem); } */

/* HOME PAGE STYLING - ENHANCED */
body.home-page {
    padding-top: 1.5rem;
    padding-bottom: 3rem;
}

.page-glow {
    position: fixed;
    inset: auto -120px -150px auto;
    width: 340px;
    height: 340px;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(143, 59, 46, 0.24), transparent 70%);
    pointer-events: none;
}

header,
main {
    width: min(900px, 100%);
}

h1,
h2,
h3 {
    font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

header {
    text-align: center;
    margin-bottom: 2.5rem;
    animation: rise-in 600ms ease-out both;
}

body.home-page header {
    margin-bottom: 2.5rem;
}

header h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3.2rem);
    letter-spacing: 0.02em;
    font-weight: 700;
}

header p {
    margin: 1rem auto 0;
    max-width: 65ch;
    color: var(--text-muted);
    font-size: clamp(1.05rem, 2.2vw, 1.3rem);
    line-height: 1.6;
}

main {
    background: var(--card-bg);
    border: 1px solid rgba(114, 43, 33, 0.15);
    border-radius: 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(3px);
    padding: clamp(1.2rem, 3vw, 2.2rem);
    animation: rise-in 700ms 120ms ease-out both;
}

body.home-page main {
    max-width: 550px;
    padding: clamp(2rem, 4vw, 3rem);
    box-shadow: 0 20px 60px rgba(72, 40, 24, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

#familyChoice {
    text-align: center;
}

body.home-page #familyChoice h2 {
    margin-top: 0;
    margin-bottom: 2rem;
    font-size: clamp(1.4rem, 2.8vw, 1.8rem);
    letter-spacing: 0.01em;
}

section h2 {
    margin: 0 0 1.25rem;
    font-size: clamp(1.2rem, 2.6vw, 1.6rem);
}

.button-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(160px, 1fr));
}

body.home-page .button-grid {
    gap: 1.2rem;
    grid-template-columns: repeat(2, 1fr);
}

.family-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(143, 59, 46, 0.35);
    border-radius: 14px;
    background: linear-gradient(180deg, #fffefc 0%, #f9ece2 100%);
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 600;
    padding: 0.9rem 1rem;
    text-decoration: none;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 220ms ease, border-color 220ms ease, background 220ms ease;
}

body.home-page .family-button {
    padding: 1.1rem 1.2rem;
    font-size: 1.05rem;
    border-radius: 16px;
    box-shadow: 0 8px 16px rgba(114, 43, 33, 0.12);
}

.family-button:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 10px 20px rgba(114, 43, 33, 0.15);
    background: linear-gradient(180deg, #fff6f0 0%, var(--accent-soft) 100%);
}

body.home-page .family-button:hover {
    box-shadow: 0 14px 32px rgba(114, 43, 33, 0.2);
    transform: translateY(-3px);
}

.family-button:active {
    transform: translateY(0);
}

.family-button:focus-visible {
    outline: 3px solid rgba(114, 43, 33, 0.35);
    outline-offset: 2px;
}

.recipe-page {
    display: grid;
    gap: 1.1rem;
}

.recipe-page section {
    text-align: left;
}

.recipe-page section h2 {
    margin-bottom: 0.5rem;
}

.recipe-page section p {
    margin: 0 0 1rem;
    color: var(--text-muted);
}

.recipe-list {
    display: grid;
    gap: 0.75rem;
}

.recipe-workspace {
    display: grid;
    grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.recipe-panel-stack {
    min-height: 460px;
}

.recipe-link {
    appearance: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.9rem;
    width: 100%;
    border: 2px solid rgba(143, 59, 46, 0.35);
    border-radius: 14px;
    background: linear-gradient(180deg, #fffefc 0%, #f9ece2 100%);
    box-shadow: 0 8px 16px rgba(114, 43, 33, 0.1);
    padding: 0.95rem 1rem;
    text-decoration: none;
    text-align: left;
    color: var(--text-main);
    font: inherit;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 220ms ease, border-color 220ms ease, background 220ms ease;
}

.recipe-link:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 10px 20px rgba(114, 43, 33, 0.15);
    background: linear-gradient(180deg, #fff6f0 0%, var(--accent-soft) 100%);
}

.recipe-link:active {
    transform: translateY(0);
}

.recipe-link:focus-visible {
    outline: 3px solid rgba(114, 43, 33, 0.35);
    outline-offset: 2px;
}

.recipe-link strong {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 1.02rem;
}

.recipe-link span {
    display: block;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.45;
}

.recipe-link::after {
    content: ">";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: rgba(143, 59, 46, 0.12);
    color: var(--accent-strong);
    font-size: 1.05rem;
    font-weight: 700;
}

.recipe-link[aria-expanded="true"] {
    border-color: var(--accent);
    background: linear-gradient(180deg, #fff6f0 0%, var(--accent-soft) 100%);
    box-shadow: 0 10px 20px rgba(114, 43, 33, 0.15);
}

.recipe-detail-section {
    margin-top: 0;
    padding: 1rem 1.1rem;
    border: 1px solid rgba(114, 43, 33, 0.15);
    border-radius: 16px;
    background: linear-gradient(180deg, #fffdf9 0%, #f9efe6 100%);
    box-shadow: 0 10px 22px rgba(72, 40, 24, 0.09);
}

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

.recipe-detail-section h3 {
    margin: 0 0 0.6rem;
}

.recipe-detail-section p {
    margin: 0 0 0.85rem;
}

.recipe-detail-section ul,
.recipe-detail-section ol {
    margin: 0 0 1rem;
    padding-left: 1.2rem;
}

.recipe-detail-section li + li {
    margin-top: 0.35rem;
}

.recipe-template-note {
    margin: 0;
    padding-top: 0.75rem;
    border-top: 1px dashed rgba(114, 43, 33, 0.18);
    color: var(--text-muted);
    font-size: 0.95rem;
}

@media (max-width: 860px) {
    body {
        padding: 2rem 0.85rem;
    }

    body.home-page {
        padding-top: 1.2rem;
        padding-bottom: 2rem;
    }

    main {
        padding: 1rem;
    }

    body.home-page main {
        padding: 1.8rem 1.5rem;
        max-width: 100%;
    }

    body.home-page header {
        margin-bottom: 1.8rem;
    }

    body.home-page #familyChoice h2 {
        margin-bottom: 1.5rem;
        font-size: 1.3rem;
    }

    .button-grid {
        grid-template-columns: 1fr;
    }

    body.home-page .button-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .recipe-workspace {
        grid-template-columns: 1fr;
    }

    .recipe-panel-stack {
        min-height: 0;
    }

    .recipe-detail-section {
        margin-top: 0.75rem;
    }

}

@media (max-width: 520px) {
    body.home-page {
        padding-top: 1rem;
        padding-bottom: 1.5rem;
    }

    body.home-page main {
        padding: 1.5rem 1rem;
    }

    body.home-page header {
        margin-bottom: 1.5rem;
    }

    body.home-page header h1 {
        font-size: 1.6rem;
    }

    body.home-page header p {
        font-size: 0.95rem;
        margin: 0.8rem auto 0;
    }

    body.home-page #familyChoice h2 {
        font-size: 1.1rem;
        margin-bottom: 1.2rem;
    }

    body.home-page .button-grid {
        grid-template-columns: 1fr;
        gap: 0.9rem;
    }

    body.home-page .family-button {
        padding: 0.95rem 1rem;
        font-size: 0.95rem;
    }

    .recipe-link {
        grid-template-columns: 1fr;
        gap: 0.6rem;
        padding: 0.85rem 0.9rem;
    }

    .recipe-link::after {
        display: none;
    }

    .recipe-link strong {
        font-size: 0.98rem;
    }

    .recipe-link span {
        font-size: 0.9rem;
        line-height: 1.4;
    }
}

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