:root{
    --cdh-card-border:#e2e2e2;
    --cdh-muted:#6b6b6b;
    --cdh-soft:#f7f7f5;
    --cdh-radius:16px;
}

html{scroll-behavior:smooth}

.cdh-jump-wrap{margin:1.25rem 0}
.cdh-jump-link{
    display:inline-flex;
    align-items:center;
    gap:.35rem;
    text-decoration:none;
    font-weight:700;
    padding:.7rem 1rem;
    border:1px solid currentColor;
    border-radius:999px;
}

.cdh-recipe-card{
    max-width:1180px;
    margin:2.5rem auto;
    border:1px solid var(--cdh-card-border);
    border-radius:var(--cdh-radius);
    background:#fff;
    overflow:hidden;
    box-shadow:0 12px 30px rgba(0,0,0,.05);
}

.cdh-recipe-hero{
    display:grid;
    grid-template-columns:minmax(0,1.15fr) minmax(300px,.85fr);
    gap:0;
    align-items:stretch;
}

.cdh-recipe-hero-copy{
    padding:clamp(24px,4vw,52px);
}

.cdh-recipe-hero-image{
    margin:0;
    min-height:320px;
    background:#eee;
}

.cdh-recipe-hero-image img{
    width:100%;
    height:100%;
    object-fit:cover;
    display:block;
}

.cdh-kicker{
    text-transform:uppercase;
    letter-spacing:.08em;
    font-size:.78rem;
    font-weight:800;
    margin:0 0 .35rem;
    color:var(--cdh-muted);
}

.cdh-recipe-hero h2{
    margin:.2rem 0 .8rem;
    font-size:clamp(2rem,4vw,3.5rem);
    line-height:1.05;
}

.cdh-recipe-summary{
    font-size:1.05rem;
    line-height:1.65;
    color:#444;
    max-width:65ch;
}

.cdh-chips{
    display:flex;
    flex-wrap:wrap;
    gap:.45rem;
    margin:.9rem 0 1rem;
}

.cdh-chip{
    display:inline-flex;
    align-items:center;
    text-decoration:none;
    border:1px solid var(--cdh-card-border);
    border-radius:999px;
    padding:.32rem .68rem;
    font-size:.82rem;
    background:var(--cdh-soft);
}

.cdh-recipe-toolbar{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:1rem;
    padding:14px clamp(20px,4vw,48px);
    border-top:1px solid var(--cdh-card-border);
    border-bottom:1px solid var(--cdh-card-border);
    background:var(--cdh-soft);
}

.cdh-servings-control{
    display:flex;
    align-items:center;
    flex-wrap:wrap;
    gap:.6rem;
}

.cdh-toolbar-label{
    font-weight:800;
}

.cdh-servings-buttons{
    display:inline-flex;
    align-items:center;
    border:1px solid #ccc;
    border-radius:999px;
    overflow:hidden;
    background:#fff;
}

.cdh-servings-buttons button{
    width:38px;
    height:34px;
    border:0;
    background:#fff;
    cursor:pointer;
    font-size:1.2rem;
}

.cdh-servings-buttons button:disabled{
    opacity:.35;
    cursor:not-allowed;
}

.cdh-servings-value{
    min-width:40px;
    text-align:center;
    font-weight:800;
}

.cdh-servings-unit{
    color:var(--cdh-muted);
}

.cdh-print-button{
    border:1px solid currentColor;
    background:#fff;
    border-radius:999px;
    padding:.62rem .95rem;
    cursor:pointer;
    font-weight:700;
}

.cdh-recipe-facts{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(135px,1fr));
    border-bottom:1px solid var(--cdh-card-border);
}

.cdh-fact{
    padding:1rem clamp(16px,2vw,24px);
    border-right:1px solid var(--cdh-card-border);
}

.cdh-fact:last-child{border-right:0}
.cdh-fact strong,.cdh-fact span{display:block}
.cdh-fact strong{
    font-size:.75rem;
    text-transform:uppercase;
    letter-spacing:.05em;
    color:var(--cdh-muted);
    margin-bottom:.2rem;
}
.cdh-fact span{font-weight:700}

.cdh-recipe-columns{
    display:grid;
    grid-template-columns:minmax(280px,.78fr) minmax(0,1.6fr);
    gap:clamp(30px,5vw,70px);
    padding:clamp(24px,4vw,52px);
}

.cdh-recipe-card h3{
    font-size:1.5rem;
    margin-top:0;
    border-bottom:2px solid currentColor;
    padding-bottom:.4rem;
}

.cdh-section-heading{
    display:flex;
    justify-content:space-between;
    align-items:end;
    gap:1rem;
}

.cdh-serving-caption{
    color:var(--cdh-muted);
    font-size:.9rem;
    white-space:nowrap;
    margin-bottom:.55rem;
}

.cdh-group-title{
    margin:1.5rem 0 .6rem;
    font-size:1.05rem;
}

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

.cdh-recipe-ingredients li{
    padding:.62rem 0;
    border-bottom:1px dotted #ddd;
}

.cdh-recipe-ingredients label{
    display:flex;
    align-items:flex-start;
    gap:.55rem;
    cursor:pointer;
}

.cdh-recipe-ingredients input{
    margin-top:.25rem;
    flex:0 0 auto;
}

.cdh-recipe-ingredients input:checked + .cdh-ingredient-line{
    text-decoration:line-through;
    opacity:.5;
}

.cdh-ingredient-quantity,
.cdh-ingredient-unit{
    font-weight:800;
}

.cdh-ingredient-note{
    color:var(--cdh-muted);
}

.cdh-step{
    display:grid;
    grid-template-columns:46px minmax(0,1fr);
    gap:14px;
    margin:0 0 1.8rem;
}

.cdh-step-number{
    width:40px;
    height:40px;
    border:1px solid currentColor;
    border-radius:50%;
    display:grid;
    place-items:center;
    font-weight:800;
}

.cdh-step-body h4{
    margin:.1rem 0 .4rem;
    font-size:1.05rem;
}

.cdh-step-text{
    line-height:1.7;
}

.cdh-step-image{
    max-width:100%;
    height:auto;
    border-radius:12px;
    margin-top:.75rem;
}

.cdh-nutrition,
.cdh-recipe-notes{
    padding:0 clamp(24px,4vw,52px) clamp(24px,4vw,52px);
}

.cdh-nutrition-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(120px,1fr));
    gap:10px;
}

.cdh-nutrition-grid>div{
    border:1px solid var(--cdh-card-border);
    padding:.8rem;
    border-radius:10px;
    background:var(--cdh-soft);
}

.cdh-nutrition-grid strong,.cdh-nutrition-grid span{display:block}
.cdh-nutrition-grid strong{font-size:.8rem;color:var(--cdh-muted)}

.cdh-recipe-source{
    padding:16px clamp(24px,4vw,52px);
    border-top:1px solid var(--cdh-card-border);
    color:var(--cdh-muted);
    font-size:.9rem;
    background:var(--cdh-soft);
}

@media(max-width:860px){
    .cdh-recipe-hero{grid-template-columns:1fr}
    .cdh-recipe-hero-image{min-height:240px;order:-1}
    .cdh-recipe-columns{grid-template-columns:1fr}
}

@media(max-width:560px){
    .cdh-recipe-card{
        margin:1.5rem 0;
        border-radius:12px;
    }

    .cdh-recipe-toolbar{
        align-items:flex-start;
        flex-direction:column;
    }

    .cdh-print-button{
        width:100%;
    }

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

    .cdh-fact{
        border-right:0;
        border-bottom:1px solid var(--cdh-card-border);
    }

    .cdh-recipe-columns{
        padding:22px 18px;
    }

    .cdh-section-heading{
        display:block;
    }

    .cdh-serving-caption{
        display:block;
        margin-top:-.25rem;
    }
}

@media print{
    @page{margin:12mm}

    body *{
        visibility:hidden !important;
    }

    .cdh-recipe-card,
    .cdh-recipe-card *{
        visibility:visible !important;
    }

    .cdh-recipe-card{
        position:absolute;
        left:0;
        top:0;
        width:100%;
        max-width:none;
        border:0;
        box-shadow:none;
        margin:0;
        overflow:visible;
    }

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

    .cdh-recipe-hero-image,
    .cdh-recipe-toolbar,
    .cdh-jump-wrap{
        display:none !important;
    }

    .cdh-recipe-hero-copy{
        padding:0 0 10mm;
    }

    .cdh-recipe-columns{
        display:grid;
        grid-template-columns:38% 58%;
        gap:4%;
        padding:10mm 0 0;
    }

    .cdh-recipe-facts{
        border-top:1px solid #aaa;
        border-bottom:1px solid #aaa;
    }

    .cdh-chip{
        border:1px solid #aaa;
        background:none;
    }

    .cdh-recipe-ingredients input{
        display:none;
    }

    .cdh-step-image{
        max-height:70mm;
        object-fit:contain;
    }

    .cdh-nutrition,
    .cdh-recipe-notes,
    .cdh-recipe-source{
        padding-left:0;
        padding-right:0;
    }
}


/* ===== CdH Recipe Index ===== */
.cdh-recipe-index{max-width:1240px;margin:2rem auto}
.cdh-index-filters{border:1px solid var(--cdh-card-border);border-radius:var(--cdh-radius);padding:clamp(18px,3vw,30px);background:#fff}
.cdh-index-search{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;align-items:end}
.cdh-index-search label,.cdh-index-field{display:block}
.cdh-index-search label>span,.cdh-index-field>span{display:block;font-size:.8rem;font-weight:800;text-transform:uppercase;letter-spacing:.04em;margin-bottom:.35rem;color:var(--cdh-muted)}
.cdh-index-search input,.cdh-index-field select{width:100%;min-height:44px;border:1px solid #c9c9c9;border-radius:8px;padding:.55rem .7rem;background:#fff}
.cdh-index-search button,.cdh-index-actions button{min-height:44px;border:1px solid currentColor;border-radius:8px;padding:.55rem 1rem;background:#fff;font-weight:800;cursor:pointer}
.cdh-index-filter-grid{display:grid;grid-template-columns:repeat(4,minmax(150px,1fr));gap:14px;margin-top:18px}
.cdh-index-actions{display:flex;align-items:center;gap:14px;margin-top:18px}
.cdh-index-actions a{font-weight:700}
.cdh-az{display:flex;flex-wrap:wrap;gap:5px;margin:22px 0}
.cdh-az a{min-width:34px;height:34px;display:grid;place-items:center;border:1px solid var(--cdh-card-border);border-radius:7px;text-decoration:none;font-weight:700;background:#fff}
.cdh-az a.is-active{background:#111;color:#fff;border-color:#111}
.cdh-index-summary{margin:14px 0 18px;color:var(--cdh-muted)}
.cdh-index-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:22px}
.cdh-index-card{border:1px solid var(--cdh-card-border);border-radius:14px;overflow:hidden;background:#fff;display:flex;flex-direction:column}
.cdh-index-card-image{aspect-ratio:4/3;background:var(--cdh-soft);display:block;overflow:hidden;text-decoration:none}
.cdh-index-card-image img{width:100%;height:100%;object-fit:cover;display:block;transition:transform .25s ease}
.cdh-index-card:hover .cdh-index-card-image img{transform:scale(1.025)}
.cdh-index-placeholder{width:100%;height:100%;display:grid;place-items:center;font-weight:900;font-size:2rem;color:#999}
.cdh-index-card-body{padding:18px;display:flex;flex-direction:column;flex:1}
.cdh-index-card-meta{font-size:.78rem;color:var(--cdh-muted);font-weight:700;text-transform:uppercase;letter-spacing:.04em}
.cdh-index-card h3{font-size:1.3rem;border:0;padding:0;margin:.4rem 0}
.cdh-index-card h3 a{text-decoration:none}
.cdh-index-card p{color:#555;line-height:1.55}
.cdh-index-more{font-weight:800;text-decoration:none;margin-top:auto;padding-top:10px}
.cdh-index-empty{padding:45px 20px;text-align:center;border:1px dashed #bbb;border-radius:12px}
.cdh-index-pagination ul{list-style:none;padding:0;display:flex;flex-wrap:wrap;gap:6px;justify-content:center;margin:28px 0}
.cdh-index-pagination a,.cdh-index-pagination span{display:grid;place-items:center;min-width:38px;height:38px;padding:0 10px;border:1px solid var(--cdh-card-border);border-radius:7px;text-decoration:none}
.cdh-index-pagination .current{background:#111;color:#fff;border-color:#111}
@media(max-width:980px){.cdh-index-filter-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.cdh-index-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:620px){.cdh-index-search{grid-template-columns:1fr}.cdh-index-filter-grid{grid-template-columns:1fr}.cdh-index-grid{grid-template-columns:1fr}.cdh-index-actions{align-items:stretch;flex-direction:column}.cdh-index-actions button,.cdh-index-actions a{text-align:center;width:100%}}


/* ===== CdH 1.7 User Features ===== */
.cdh-user-tools{max-width:1180px;margin:1.5rem auto;display:grid;grid-template-columns:1fr 1fr;gap:18px}
.cdh-favorite-panel,.cdh-rating-panel{border:1px solid var(--cdh-card-border);border-radius:14px;padding:18px;background:#fff}
.cdh-favorite-button{display:inline-flex;align-items:center;gap:.55rem;border:1px solid currentColor;border-radius:999px;background:#fff;padding:.65rem 1rem;font-weight:800;cursor:pointer}
.cdh-favorite-button.is-favorite .cdh-heart{font-size:1.2rem}
.cdh-rating-panel{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap}
.cdh-rating-summary{display:flex;align-items:baseline;gap:.35rem;flex-wrap:wrap}
.cdh-rating-average{font-size:1.5rem}
.cdh-rating-stars{display:flex;gap:3px}
.cdh-rate-star{border:0;background:transparent;font-size:1.7rem;line-height:1;color:#c8a100;cursor:pointer;padding:3px}
.cdh-rate-star:disabled{opacity:.45;cursor:not-allowed}
.cdh-rating-message{flex-basis:100%;margin:0;color:var(--cdh-muted);font-size:.9rem}
.cdh-related{max-width:1180px;margin:2.5rem auto}
.cdh-related>h2{margin-bottom:1rem}
.cdh-favorites{max-width:1240px;margin:2rem auto}
.cdh-favorites-login{padding:30px;border:1px solid var(--cdh-card-border);border-radius:14px;background:#fff}
.cdh-ingredient-finder{max-width:1240px;margin:2rem auto}
.cdh-finder-form{border:1px solid var(--cdh-card-border);border-radius:var(--cdh-radius);padding:clamp(18px,3vw,30px);background:#fff;margin-bottom:24px}
.cdh-finder-search-wrap{margin:18px 0}
.cdh-finder-search{width:100%;min-height:44px;border:1px solid #c9c9c9;border-radius:8px;padding:.55rem .7rem}
.cdh-finder-terms{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;max-height:420px;overflow:auto;padding:4px}
.cdh-finder-terms label{display:flex;align-items:center;gap:.5rem;border:1px solid var(--cdh-card-border);border-radius:8px;padding:.55rem .65rem;cursor:pointer;background:#fff}
.cdh-finder-terms label:has(input:checked){background:var(--cdh-soft);font-weight:700}
@media(max-width:900px){.cdh-finder-terms{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:620px){.cdh-user-tools{grid-template-columns:1fr}.cdh-finder-terms{grid-template-columns:1fr}}


/* ===== CdH 1.8 Collections, Dashboard, Taxonomies ===== */
.cdh-collection,.cdh-user-dashboard,.cdh-taxonomy-page{max-width:1240px;margin:2rem auto;padding-left:16px;padding-right:16px}
.cdh-collection-header,.cdh-taxonomy-hero{margin-bottom:24px}
.cdh-collection-header h2,.cdh-taxonomy-hero h1{font-size:clamp(2rem,4vw,3.4rem);margin:.15rem 0 .7rem}
.cdh-dashboard-header{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;margin-bottom:22px}
.cdh-dashboard-header h2{font-size:clamp(2rem,4vw,3rem);margin:.15rem 0}
.cdh-dashboard-stats{display:grid;grid-template-columns:repeat(2,minmax(0,220px));gap:12px;margin-bottom:30px}
.cdh-dashboard-stats>div{border:1px solid var(--cdh-card-border);border-radius:12px;padding:18px;background:#fff}
.cdh-dashboard-stats strong,.cdh-dashboard-stats span{display:block}
.cdh-dashboard-stats strong{font-size:2rem;line-height:1}
.cdh-dashboard-stats span{margin-top:6px;color:var(--cdh-muted)}
.cdh-user-dashboard>section{margin-top:32px}
.cdh-taxonomy-description{max-width:70ch;color:#555;line-height:1.65}
@media(max-width:620px){.cdh-dashboard-header{flex-direction:column}.cdh-dashboard-stats{grid-template-columns:1fr 1fr}}


/* ===== CdH 1.9 Frontend Submissions ===== */
.cdh-submit-wrap{max-width:1100px;margin:2rem auto}
.cdh-submit-intro,.cdh-submit-form,.cdh-my-submissions,.cdh-submit-login{border:1px solid var(--cdh-card-border);border-radius:var(--cdh-radius);background:#fff;padding:clamp(18px,3vw,30px);margin-bottom:20px}
.cdh-submit-intro h2{margin-top:0;font-size:clamp(2rem,4vw,3rem)}
.cdh-submit-notice{max-width:1100px;margin:1rem auto;padding:14px 18px;border-radius:10px;background:#edf7ed;border:1px solid #bad9ba;font-weight:700}
.cdh-submit-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.cdh-span-2{grid-column:span 2}
.cdh-submit-field>span{display:block;font-weight:800;margin-bottom:.35rem}
.cdh-submit-field input,.cdh-submit-field textarea,.cdh-submit-field select,.cdh-submit-section textarea{width:100%;border:1px solid #c9c9c9;border-radius:8px;padding:.65rem .75rem}
.cdh-submit-section{margin-top:24px}
.cdh-submit-section h3{margin-bottom:.35rem}
.cdh-submit-taxonomies{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;margin-top:24px}
.cdh-submit-taxonomies fieldset{border:1px solid var(--cdh-card-border);border-radius:10px;padding:14px}
.cdh-submit-taxonomies legend{font-weight:800;padding:0 6px}
.cdh-submit-term{display:flex;gap:.45rem;align-items:center;padding:.28rem 0}
.cdh-submit-actions{display:flex;gap:12px;flex-wrap:wrap;margin-top:24px}
.cdh-submit-actions button{border:1px solid currentColor;background:#fff;border-radius:8px;padding:.7rem 1rem;font-weight:800;cursor:pointer}
.cdh-submit-actions button.is-primary{background:#111;color:#fff;border-color:#111}
.cdh-submission-list{border:1px solid var(--cdh-card-border);border-radius:10px;overflow:hidden}
.cdh-submission-row{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:12px 14px;border-bottom:1px solid var(--cdh-card-border)}
.cdh-submission-row:last-child{border-bottom:0}
@media(max-width:700px){.cdh-submit-grid,.cdh-submit-taxonomies{grid-template-columns:1fr}.cdh-span-2{grid-column:auto}.cdh-submit-actions{flex-direction:column}.cdh-submit-actions button{width:100%}}


/* ===== CdH 2.0 Moderation & Upload ===== */
.cdh-moderation-feedback{border:1px solid #d7c58b;background:#fff8df;border-radius:12px;padding:16px 18px;margin-bottom:20px}
.cdh-moderation-feedback strong{display:block;margin-bottom:.35rem}
.cdh-moderation-feedback p{margin:.35rem 0 0}
.cdh-submit-current-image{margin:.5rem 0}
.cdh-submit-current-image img{max-width:260px;height:auto;border-radius:10px;display:block}
.cdh-submit-field input[type=file]{padding:.6rem;background:#fafafa}


/* ===== CdH 2.1 Accessibility & Quality ===== */
.cdh-recipe-card a:focus-visible,
.cdh-recipe-card button:focus-visible,
.cdh-recipe-index a:focus-visible,
.cdh-recipe-index button:focus-visible,
.cdh-recipe-index input:focus-visible,
.cdh-recipe-index select:focus-visible,
.cdh-submit-wrap a:focus-visible,
.cdh-submit-wrap button:focus-visible,
.cdh-submit-wrap input:focus-visible,
.cdh-submit-wrap textarea:focus-visible,
.cdh-submit-wrap select:focus-visible,
.cdh-user-tools button:focus-visible,
.cdh-finder-form input:focus-visible{
    outline:3px solid currentColor;
    outline-offset:3px;
}
.cdh-rate-star:hover,.cdh-rate-star:focus-visible{transform:scale(1.12)}
@media (prefers-reduced-motion:reduce){
    html{scroll-behavior:auto}
    *,*::before,*::after{scroll-behavior:auto!important;transition:none!important;animation:none!important}
}
