/* ==========================================================================
   KHX RECIPE ENGINE — TEMPLATES & STYLING
   ========================================================================== */

:root {
    --khx-primary: #d97706;        /* Varm Rav */
    --khx-secondary: #f59e0b;      /* Guld */
    --khx-primary-light: #fef3c7;
    --khx-primary-border: #fde68a;
    --khx-text-main: #0f172a;
    --khx-text-muted: #64748b;
    --khx-card-bg: #ffffff;
    --khx-border-card: #e7e5e4;
}

/* ==========================================================================
   1. MEADOW VARM RAV TEMA (Standard)
   ========================================================================== */
.khx-recipe-card {
    background-color: var(--khx-card-bg);
    border: 1px solid var(--khx-border-card);
    border-radius: 16px;
    padding: 32px;
    margin: 40px auto;
    max-width: 860px;
    box-shadow: 0 10px 30px -10px rgba(217, 119, 6, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1e293b;
    line-height: 1.6;
    box-sizing: border-box;
}

.khx-recipe-card * {
    box-sizing: border-box;
}

/* Header */
.khx-card-header {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin-bottom: 24px;
}
.khx-title-wrap {
    flex: 1 1 300px;
}
.khx-recipe-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--khx-text-main);
    margin: 0 0 10px 0;
}
.khx-recipe-lead {
    color: var(--khx-text-muted);
    font-size: 16px;
    margin: 0;
}
.khx-recipe-media {
    flex: 1 1 260px;
    max-width: 320px;
}
.khx-recipe-media img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    display: block;
}

/* Meta Bar */
.khx-recipe-metabar {
    background-color: #fafaf9;
    border-radius: 12px;
    padding: 14px 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    border: 1px solid #f5f5f4;
}
.khx-meta-item {
    display: flex;
    flex-direction: column;
}
.khx-meta-label {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #a8a29e;
}
.khx-meta-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--khx-text-main);
}
.khx-meta-total .khx-meta-value {
    color: var(--khx-primary);
    font-weight: 700;
}
.khx-meta-actions {
    margin-left: auto;
}
.khx-btn-print {
    background: var(--khx-primary-light);
    color: #92400e;
    border: 1px solid var(--khx-primary-border);
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: 0.2s;
}
.khx-btn-print:hover {
    background: var(--khx-primary-border);
}

/* Portionsskalering (Stepper Kontrol) */
.khx-servings-control {
    display: flex;
    flex-direction: column;
}
.khx-servings-stepper {
    display: inline-flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 999px;
    padding: 2px 6px;
    margin-top: 2px;
}
.khx-serving-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: var(--khx-primary, #d97706);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    transition: 0.15s;
    padding: 0;
}
.khx-serving-btn:hover {
    background: var(--khx-primary, #d97706);
    color: #ffffff;
    border-color: var(--khx-primary, #d97706);
}
.khx-serving-count {
    font-weight: 700;
    font-size: 14px;
    min-width: 28px;
    text-align: center;
    color: var(--khx-text-main);
}
.khx-amount {
    font-weight: 700;
    margin-right: 2px;
    color: var(--khx-text-main);
}

/* Redskaber & Udstyr Sektion */
.khx-equipment-section {
    background: #fdfaf6;
    border: 1px solid var(--khx-primary-border);
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 24px;
}
.khx-subheading {
    margin: 0 0 10px 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--khx-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.khx-equipment-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.khx-equipment-tag {
    background: #ffffff;
    border: 1px solid var(--khx-primary-border);
    color: #451a03;
    font-size: 13px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 999px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

/* 2-Kolonner Layout */
.khx-card-body {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 36px;
}
@media (max-width: 768px) {
    .khx-card-body {
        grid-template-columns: 1fr;
    }
}
.khx-section-heading {
    font-size: 20px;
    font-weight: 700;
    color: var(--khx-text-main);
    border-bottom: 2px solid var(--khx-primary-light);
    padding-bottom: 8px;
    margin: 0 0 16px 0;
}

/* Ingredienser med tjekliste */
.khx-ingredient-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.khx-ingredient-row {
    padding: 8px 0;
    border-bottom: 1px dashed #f1f5f9;
    transition: opacity 0.2s;
}
.khx-checklist-item {
    display: flex;
    align-items: center;
    cursor: pointer;
}
.khx-ingredient-checkbox {
    accent-color: var(--khx-primary);
    width: 17px;
    height: 17px;
    margin-right: 10px;
    cursor: pointer;
}
.khx-ingredient-row.is-done {
    opacity: 0.45;
    text-decoration: line-through;
}

/* Fremgangsmåde */
.khx-instructions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--khx-primary-light);
    padding-bottom: 8px;
    margin-bottom: 16px;
}
.khx-instructions-header .khx-section-heading {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

/* Cook Mode Toggle */
.khx-cook-mode-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}
.khx-cook-mode-switch {
    position: relative;
    width: 36px;
    height: 20px;
}
.khx-cook-mode-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.khx-cook-mode-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #e2e8f0;
    border-radius: 20px;
    transition: 0.2s;
}
.khx-cook-mode-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
}
.khx-cook-mode-switch input:checked + .khx-cook-mode-slider {
    background: var(--khx-primary);
}
.khx-cook-mode-switch input:checked + .khx-cook-mode-slider:before {
    transform: translateX(16px);
}
.khx-cook-mode-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--khx-text-muted);
}

/* Trin */
.khx-instruction-steps {
    list-style: none;
    padding: 0;
    margin: 0;
}
.khx-instruction-step {
    display: flex;
    gap: 14px;
    margin-bottom: 18px;
}
.khx-step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--khx-primary-light);
    color: #92400e;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}
.khx-step-content p {
    margin: 3px 0 0 0;
}

/* ==========================================================================
   2. KOMPAKT SKABELON
   ========================================================================== */
.khx-recipe-card.khx-template-compact {
    padding: 22px 24px;
    border-radius: 10px;
    border-top: 4px solid var(--khx-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}
.khx-recipe-card.khx-template-compact .khx-recipe-title {
    font-size: 22px;
    margin-bottom: 4px;
}
.khx-recipe-card.khx-template-compact .khx-recipe-metabar {
    padding: 8px 14px;
    gap: 14px;
    margin-bottom: 16px;
    font-size: 13px;
}
.khx-recipe-card.khx-template-compact .khx-card-body {
    gap: 24px;
}
.khx-recipe-card.khx-template-compact .khx-section-heading {
    font-size: 16px;
    margin-bottom: 12px;
}

/* ==========================================================================
   3. VIDEO & PRINT
   ========================================================================== */
.khx-recipe-video-section {
    margin-top: 30px;
}
.khx-video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 12px;
}
.khx-video-container iframe,
.khx-video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.khx-print-footer {
    display: none;
}
@media print {
    body * {
        visibility: hidden;
    }
    .khx-recipe-card,
    .khx-recipe-card * {
        visibility: visible;
    }
    .khx-recipe-card {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        border: none;
        box-shadow: none;
    }
    .khx-cook-mode-wrapper,
    .khx-btn-print,
    .khx-ad-slot,
    .khx-servings-stepper button {
        display: none !important;
    }
    .khx-print-footer {
        display: block;
        margin-top: 20px;
        font-style: italic;
    }
}

/* ==========================================================================
   KHX RECIPE ENGINE — FORSIDE STYLES
   ========================================================================== */

.khx-frontpage-wrapper {
    max-width: 1180px;
    margin: 0 auto;
    padding: 20px 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #1e293b;
}

/* 1. Hero */
.khx-front-hero {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fde68a;
    border-radius: 20px;
    padding: 50px 24px;
    text-align: center;
    margin-bottom: 36px;
}
.khx-hero-badge {
    display: inline-block;
    background: #f59e0b;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 12px;
    border-radius: 999px;
    margin-bottom: 12px;
}
.khx-hero-title {
    font-size: 36px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 10px 0;
}
.khx-hero-subtitle {
    font-size: 16px;
    color: #64748b;
    margin: 0 auto 24px auto;
    max-width: 580px;
}
.khx-front-search-wrap form {
    display: flex;
    justify-content: center;
    max-width: 480px;
    margin: 0 auto;
    gap: 8px;
}
.khx-front-search-input {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    font-size: 15px;
    outline: none;
    background: #fff;
}
.khx-front-search-input:focus {
    border-color: #d97706;
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}
.khx-front-search-btn {
    background: #d97706;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 0 20px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}
.khx-front-search-btn:hover {
    background: #b45309;
}

/* 2. Kategori-piller */
.khx-front-categories {
    margin-bottom: 40px;
}
.khx-cat-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}
.khx-cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    text-decoration: none;
    transition: all 0.2s ease;
}
.khx-cat-pill:hover {
    border-color: #d97706;
    color: #d97706;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.khx-cat-count {
    background: #f1f5f9;
    color: #64748b;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 999px;
}

/* 3. Grid sektion */
.khx-section-header {
    margin-bottom: 24px;
}
.khx-section-header h2 {
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 4px 0;
}
.khx-recipe-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}
.khx-card-item {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    transition: transform 0.25s, box-shadow 0.25s;
}
.khx-card-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(0,0,0,0.08);
}
.khx-card-thumb-link {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    background: #f8fafc;
    overflow: hidden;
}
.khx-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.khx-card-item:hover .khx-card-img {
    transform: scale(1.04);
}
.khx-card-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}
.khx-badge-time {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
}
.khx-card-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.khx-card-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px 0;
    line-height: 1.35;
}
.khx-card-title a {
    color: #0f172a;
    text-decoration: none;
}
.khx-card-title a:hover {
    color: #d97706;
}
.khx-card-excerpt {
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
    margin: 0 0 16px 0;
    flex-grow: 1;
}
.khx-card-meta-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f1f5f9;
    padding-top: 12px;
    font-size: 12px;
    font-weight: 600;
}
.khx-meta-kcal {
    color: #d97706;
}
.khx-card-arrow {
    color: #0f172a;
    text-decoration: none;
    font-weight: 700;
}
.khx-card-arrow:hover {
    color: #d97706;
}

/* ==========================================================================
   FORSIDE TRANSFORMATION & TEMA-OPRYDNING
   ========================================================================== */

/* 1. Skjul den grimme standard "Forside"-titel fra temaet */
.home .entry-title,
.home h1.page-title,
.home header.entry-header,
.home .wp-block-post-title {
    display: none !important;
}

/* 2. Fjern overflødig afstand fra temaets wrapper på forsiden */
.home .site-content,
.home .entry-content,
.home main {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* 3. Hero sektion med varmt mad-udtryk */
.khx-frontpage-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px 60px 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.khx-front-hero {
    position: relative;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.88) 0%, rgba(15, 23, 42, 0.94) 100%), 
                url('https://images.unsplash.com/photo-1543353071-873f17a7a088?auto=format&fit=crop&w=1600&q=80') center/cover no-repeat;
    border-radius: 24px;
    padding: 70px 30px;
    text-align: center;
    color: #ffffff;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
    margin-bottom: 40px;
    overflow: hidden;
}

.khx-hero-badge {
    display: inline-block;
    background: #d97706;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 6px 16px;
    border-radius: 999px;
    margin-bottom: 18px;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.35);
}

.khx-hero-title {
    font-size: 44px;
    font-weight: 900;
    color: #ffffff !important;
    margin: 0 0 14px 0;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.khx-hero-subtitle {
    font-size: 18px;
    color: #cbd5e1;
    margin: 0 auto 32px auto;
    max-width: 600px;
    line-height: 1.6;
}

/* Søgefelt med glas-effekt */
.khx-front-search-wrap form {
    display: flex;
    justify-content: center;
    max-width: 520px;
    margin: 0 auto;
    gap: 10px;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px;
    border-radius: 16px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.khx-front-search-input {
    flex: 1;
    padding: 14px 20px;
    border: none !important;
    border-radius: 12px;
    font-size: 16px;
    outline: none;
    background: #ffffff !important;
    color: #0f172a !important;
}

.khx-front-search-btn {
    background: #d97706;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 0 24px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.khx-front-search-btn:hover {
    background: #b45309;
    transform: scale(1.02);
}

/* Kategori piller */
.khx-cat-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 45px;
}

.khx-cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

.khx-cat-pill:hover {
    border-color: #d97706;
    color: #d97706;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(217, 119, 6, 0.12);
}

.khx-cat-count {
    background: #fef3c7;
    color: #b45309;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
}
