/**
 * Complete Recipe Layout Styles
 * Consolidated from multiple CSS files for Recipe CPT
 */

/* ==========================================================================
   RECIPE POST CONTAINER & LAYOUT
   ========================================================================== */

:root {
    --spb-accent: var(--wp--preset--color--secondary) !important; /* unified accent color for labels, icons, and step tag */
}

/* Recipe Post Container */
/* Target recipe posts within theme structure - higher specificity */
#primary .recipe-post,
.content-area .recipe-post,
.site-main .recipe-post,
.recipe-post {
    margin: 0 auto !important;
    padding: 0 !important;
    font-family: var(--font-body-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif) !important;
    font-size: 1rem !important;
    line-height: 1.6 !important;
    color: #333 !important;
    max-width: 100% !important;
    width: 100% !important;
}

/* Collapse any theme top spacing above the hero image on single recipes */
body.single-recipe main {
    padding-top: 0 !important;
}
body.single-recipe main .entry-content {
    margin-block-start: 0 !important;
}

/* Ensure content container respects theme - use theme's default width */
#primary .recipe-post > *:not(.recipe-hero-image),
.content-area .recipe-post > *:not(.recipe-hero-image),
.site-main .recipe-post > *:not(.recipe-hero-image),
.recipe-post > *:not(.recipe-hero-image) {
    margin-inline: auto !important;
    padding-left: 2rem !important;
    padding-right: 2rem !important;
}

/* Override theme container constraints for recipe posts */
#primary.recipe-content-area,
.content-area.recipe-content-area {
    max-width: 100% !important;
    padding: 0 !important;
}

/* ==========================================================================
   HERO IMAGE
   ========================================================================== */

/* Hero Image - Full Width */
/* Ensure hero image breaks out of theme containers */
#primary .recipe-hero-image,
.content-area .recipe-hero-image,
.site-main .recipe-hero-image,
.recipe-post .recipe-hero-image,
.recipe-hero-image {
    margin: 0 0 3rem 0 !important;
    width: 100vw !important;
    position: relative !important;
    left: 50% !important;
    right: 50% !important;
    margin-left: -50vw !important;
    margin-right: -50vw !important;
    text-align: center;
    overflow: hidden;
    max-width: 100vw !important;
}

.recipe-hero-image::before {
    content: '';
    display: block;
    padding-bottom: 50%; /* 2:1 aspect ratio */
}

.recipe-featured-image {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
}

/* On single recipe pages, constrain featured media to theme wide size and center it */
body.single-recipe .recipe-hero-image {
    max-width: var(--wp--style--global--wide-size, 1200px) !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    position: static !important;
    left: auto !important;
    right: auto !important;
    aspect-ratio: 16 / 7 !important; /* keep 16:7 viewport */
    overflow: hidden !important;
}

body.single-recipe .recipe-hero-image::before {
    display: none !important;
    padding-bottom: 0 !important;
}

body.single-recipe .recipe-featured-image {
    position: static !important;
    width: 100% !important;
    height: 100% !important; /* fill wrapper while preserving crop */
    display: block !important;
    margin: 0 auto !important;
    object-fit: cover !important;
}

/* ==========================================================================
   RECIPE HEADER & METADATA
   ========================================================================== */

/* Recipe Header */
/* Higher specificity to override theme styles */
#primary .recipe-header,
.content-area .recipe-header,
.site-main .recipe-header,
.recipe-post .recipe-header,
.recipe-header {
    text-align: center !important;
    padding: 2rem 0 !important;
}

.recipe-meta {
    font-family: var(--font-body-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    font-weight: 500 !important;
}

.recipe-meta-separator {
    margin: 0 0.5rem !important;
}

/* ==========================================================================
   RECIPE INFO BAR
   ========================================================================== */

/* Recipe Info Bar */
.recipe-info-bar {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 1.5rem !important;
    margin: 1rem auto !important;
    padding: 0 !important;
    background: transparent !important;
    flex-wrap: wrap !important;
}

.recipe-info-item {
    display: flex !important;
    align-items: center !important;
    font-family: var(--font-body-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif) !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    gap: 0.5rem !important;
}

.recipe-info-icon {
    display: inline-block !important;
    width: 18px !important;
    height: 18px !important;
    margin-right: 6px !important;
    position: relative !important;
    color: var(--spb-accent) !important; /* monochrome accent */
}

/* Make emoji icons appear monochrome */
.emoji-icon {
    filter: grayscale(1) brightness(0.2) !important;
}

/* Servings icon: use fork-knife SVG as monochrome mask */
.recipe-icon-servings {
    -webkit-mask: url('/wp-content/plugins/spicepilgrim-blog-plugin/assets/icons/fork-knife.svg') no-repeat center / contain;
    mask: url('/wp-content/plugins/spicepilgrim-blog-plugin/assets/icons/fork-knife.svg') no-repeat center / contain;
    background: currentColor !important;
}

/* Time icon: use clock SVG as monochrome mask */
.recipe-icon-time {
    -webkit-mask: url('/wp-content/plugins/spicepilgrim-blog-plugin/assets/icons/clock.svg') no-repeat center / contain;
    mask: url('/wp-content/plugins/spicepilgrim-blog-plugin/assets/icons/clock.svg') no-repeat center / contain;
    background: currentColor !important;
}

/* Difficulty icon: use chef-hat SVG as monochrome mask */
.recipe-icon-difficulty {
    -webkit-mask: url('/wp-content/plugins/spicepilgrim-blog-plugin/assets/icons/chef-hat.svg') no-repeat center / contain;
    mask: url('/wp-content/plugins/spicepilgrim-blog-plugin/assets/icons/chef-hat.svg') no-repeat center / contain;
    background: currentColor !important;
}

.recipe-info-label {
    font-weight: 600 !important;
    color: var(--spb-accent) !important;
    margin-right: 0 !important;
    text-transform: uppercase !important;
    font-size: 0.75rem !important;
    letter-spacing: 0.05em !important;
}

.recipe-info-value {
    font-weight: 600 !important;
    color: #1a1a1a !important;
    text-transform: uppercase !important;
}

/* Secondary info bar for cuisine and difficulty */
.recipe-info-bar-secondary {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4rem;
    padding: 1rem 0 2rem 0;
    background: transparent;
    margin: 0 0 3rem 0;
    border-top: 1px solid #e0e0e0;
    padding-top: 1.5rem;
}

/* ==========================================================================
   RECIPE CONTENT - SINGLE COLUMN LAYOUT
   ========================================================================== */

/* Recipe Content - Single column container */
/* Let theme handle width - same as regular blog posts */
#primary .recipe-content,
.content-area .recipe-content,
.site-main .recipe-content,
.recipe-post .recipe-content,
.recipe-content {
    display: block !important;
    margin: 3rem auto !important;
}

/* Ingredients block - no special styling */
.recipe-content .wp-block-scb-recipes-ingredients,
.recipe-content .wp-block-spb-recipes-ingredients {
    margin-bottom: 3rem !important;
}

/* Ingredients block heading styling */
.recipe-content .wp-block-scb-recipes-ingredients h2,
.recipe-content .wp-block-scb-recipes-ingredients h3,
.recipe-content .wp-block-spb-recipes-ingredients h2,
.recipe-content .wp-block-spb-recipes-ingredients h3 {
    margin-bottom: 1.5rem !important;
}

/* Steps block styling */
.recipe-content .wp-block-scb-recipes-steps,
.recipe-content .wp-block-spb-recipes-steps {
    margin-bottom: 3rem !important;
}

.recipe-content .wp-block-scb-recipes-steps h2,
.recipe-content .wp-block-scb-recipes-steps h3,
.recipe-content .wp-block-spb-recipes-steps h2,
.recipe-content .wp-block-spb-recipes-steps h3 {
    margin-bottom: 1.5rem !important;
}

/* Notes and other blocks */
.recipe-content .wp-block-scb-recipes-notes,
.recipe-content .wp-block-spb-recipes-notes,
.recipe-content .wp-block-scb-recipes-nutrition,
.recipe-content .wp-block-spb-recipes-nutrition {
    margin-top: 3rem !important;
    margin-bottom: 3rem !important;
}

.recipe-content .wp-block-scb-recipes-notes h2,
.recipe-content .wp-block-scb-recipes-notes h3,
.recipe-content .wp-block-spb-recipes-notes h2,
.recipe-content .wp-block-spb-recipes-notes h3 {
    margin-bottom: 1.5rem !important;
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */
/* Typography for all headings */
.recipe-post .recipe-content > h3,
.recipe-post .recipe-content h3,
article.recipe-post .recipe-content > h3,
article.recipe-post .recipe-content h3 {
    margin-bottom: 1.25rem !important;
}

/* ==========================================================================
   INGREDIENTS
   ========================================================================== */

/* Ingredient Groups */
.ingredients-groups {
    margin: 0;
}

.ingredient-group {
    margin-bottom: 3rem;
}

.ingredient-group .group-title,
.ingredient-group h3 {
    margin-bottom: 1.5rem;
}

.ingredient-item {
    padding: 0.5rem;
}

/* ==========================================================================
   INSTRUCTIONS/STEPS
   ========================================================================== */

/* Step Groups */
.steps-groups {
    margin: 0;
}

.steps-group {
    margin-bottom: 3rem;
}

.steps-group h4 {
    margin-bottom: 1.5rem;
}

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

.step-item {
    margin-bottom: 1rem;
}

/* Step numbering for instructions */
.steps-list {
    list-style: none !important;
    padding-left: 0 !important;
    counter-reset: step-counter !important;
}

.step-item {
    position: relative !important;
    padding-left: 4rem !important;
    margin-bottom: 1.5rem !important;
    list-style: none !important;
}

.step-item::before {
    content: 'STEP ' counter(step-counter) !important;
    counter-increment: step-counter !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    font-family: var(--font-body-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif) !important;
    font-weight: 700 !important;
    font-size: 0.75rem !important;
    color: var(--spb-accent) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.1em !important;
    line-height: 1.5 !important;
}

.step-content {
    margin-left: 0 !important;
}


/* ==========================================================================
   NOTES & TIPS
   ========================================================================== */

/* Notes Section */
.notes-list {
    margin: 0;
}

.notes-group {
    margin-bottom: 3rem;
}

.notes-group h4 {
    margin-bottom: 1.5rem;
}

.notes-tips-list {
    margin: 0;
    padding: 0;
}

.note-tip {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
    position: relative;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 768px) {
    .recipe-post > *:not(.recipe-hero-image) {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }

    .recipe-hero-image {
        margin: 0 0 2rem 0 !important;
    }

    .recipe-title {
        font-size: 2.5rem !important;
    }

    .recipe-info-bar {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
}

@media (max-width: 480px) {
    .recipe-post {
        padding: 0 1rem;
    }

    .recipe-hero-image {
        margin: 0 -1rem 2rem -1rem;
    }
}

/* ==========================================================================
   PRIMARY CATEGORY BLOCK (similar to Categories block)
   ========================================================================== */

.spb-primary-category-block {
    display: inline-block;
    font-size: inherit;
    line-height: inherit;
}

.spb-primary-category-link {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

.spb-primary-category-link:hover {
    color: var(--spb-accent, #6a8f6a);
    text-decoration: underline;
}

.spb-primary-category-text {
    color: inherit;
}

/* Editor preview styles */
.spb-primary-category-block-preview {
    padding: 0.5rem;
    background: #f9f9f9;
    border: 1px dashed #ccc;
    border-radius: 4px;
}

.spb-primary-category-block-preview .spb-primary-category-block {
    margin: 0;
}
