/* Custom CSS for Candle Making Guide */

/* Color Variables */
:root {
    --candle-flame: #e36a2e;
    --warm-wax: #d98b48;
    --natural-beige: #efe2cf;
    --earth-brown: #6f4e37;
    --soft-cream: #faf6ef;

    /* Material color tokens (light) */
    --md-primary-fg-color: var(--earth-brown);
    --md-accent-fg-color: var(--candle-flame);
    --md-default-bg-color: var(--soft-cream);
}

/* Force light appearance across the whole site */
html {
    color-scheme: light;
}
body {
    background-color: var(--soft-cream);
}

/* Also override if Material ever sets a dark scheme */
[data-md-color-scheme='slate'] {
    --md-default-bg-color: var(--soft-cream);
    --md-primary-fg-color: var(--earth-brown);
    --md-accent-fg-color: var(--candle-flame);
    --md-typeset-color: #332a25;
    --md-code-bg-color: #f6efe6;
    --md-code-fg-color: #3b2d2a;
}

/* Code blocks and inline code on all pages */
:root {
    --md-code-bg-color: #f6efe6;
    --md-code-fg-color: #3b2d2a;
}
.md-typeset pre > code,
.md-typeset code {
    background-color: var(--md-code-bg-color);
    color: var(--md-code-fg-color);
}

/* Ensure all main containers keep the light parchment feel */
.md-main,
.md-content,
.md-container,
.md-content__inner {
    background: linear-gradient(180deg, var(--soft-cream), var(--natural-beige) 120%);
}

/* Header & tabs: lighter, warm */
.md-header,
.md-tabs {
    background-color: var(--soft-cream);
    color: var(--earth-brown);
    border-bottom: 1px solid var(--natural-beige);
}
.md-header__title,
.md-tabs__link {
    color: var(--earth-brown);
}
.md-tabs__link--active {
    color: var(--candle-flame);
}

/* Hero Section Styling */
.hero-banner {
    background: linear-gradient(135deg, var(--soft-cream) 0%, var(--natural-beige) 100%);
    padding: 2rem;
    margin: -0.5rem -0.5rem 2rem -0.5rem;
    border-radius: 10px;
    text-align: center;
    border: 1px solid var(--natural-beige);
}
.hero-banner h1,
.hero-banner h2,
.hero-banner h3 {
    color: var(--earth-brown);
    margin-bottom: 0.75rem;
}

/* Card Grid Styling */
.grid.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}
.grid.cards > * {
    background: var(--soft-cream);
    border: 1px solid var(--natural-beige);
    border-radius: 8px;
    padding: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.grid.cards > *:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(111, 78, 55, 0.12);
}

/* Safety & status */
.admonition.warning {
    border-left: 4px solid var(--candle-flame);
}
.admonition.danger {
    background-color: #fff5f5;
    border-left: 4px solid #e53e3e;
}
.admonition.success {
    background-color: #f0fff4;
    border-left: 4px solid #38a169;
}

/* Temperature Display */
.temperature-box {
    background: linear-gradient(45deg, var(--warm-wax), var(--candle-flame));
    color: white;
    padding: 1rem;
    border-radius: 6px;
    text-align: center;
    font-weight: bold;
    margin: 1rem 0;
}

/* Recipe Card */
.recipe-card {
    background: var(--soft-cream);
    border: 2px solid var(--natural-beige);
    border-radius: 10px;
    padding: 1.5rem;
    margin: 2rem 0;
}
.recipe-card h3 {
    color: var(--earth-brown);
    border-bottom: 2px solid var(--warm-wax);
    padding-bottom: 0.5rem;
}

/* Buttons */
.md-button {
    background-color: var(--candle-flame);
    border-color: var(--candle-flame);
    color: white;
}
.md-button:hover {
    background-color: var(--warm-wax);
    border-color: var(--warm-wax);
}

/* Tables */
table {
    border-collapse: collapse;
    margin: 1rem 0;
    width: 100%;
}
table th {
    background-color: var(--natural-beige);
    color: var(--earth-brown);
    font-weight: 600;
}
table tr:nth-child(even) {
    background-color: var(--soft-cream);
}

/* Checklists */
.task-list-item input[type='checkbox']:checked + label::before {
    background-color: var(--candle-flame);
    border-color: var(--candle-flame);
}

/* Sidebars and navigation */
.md-sidebar--primary,
.md-sidebar--secondary,
.md-nav {
    background-color: var(--soft-cream);
}
.md-sidebar--primary {
    border-right: 1px solid var(--natural-beige);
}

/* Footer */
.md-footer {
    background-color: var(--soft-cream);
    border-top: 1px solid var(--natural-beige);
}

/* Links use warm accent but readable */
.md-typeset a {
    color: var(--candle-flame);
}
.md-typeset a:hover {
    color: var(--warm-wax);
}

/* Mobile */
@media (max-width: 768px) {
    .grid.cards {
        grid-template-columns: 1fr;
    }
    .hero-banner {
        margin: -0.5rem -0.5rem 1rem -0.5rem;
        padding: 1rem;
    }
    .recipe-card {
        padding: 1rem;
        margin: 1rem 0;
    }
}

/* Print */
@media print {
    .recipe-card {
        break-inside: avoid;
        border: 2px solid #333;
    }
    .admonition.warning,
    .admonition.danger {
        border-left: 4px solid #333;
    }
    /* Hide the decorative candle when printing */
    #calm-candle {
        display: none !important;
    }
}

/* ——— Relaxing CSS Candle (decorative) ——— */
#calm-candle {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    width: 24px;
    height: 56px;
    z-index: 999;
    opacity: 0.9;
    pointer-events: none; /* purely decorative */
}
#calm-candle .wax {
    position: absolute;
    left: 5px;
    bottom: 0;
    width: 14px;
    height: 34px;
    background: linear-gradient(180deg, var(--natural-beige), #e8d6bb);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 3px;
    box-shadow: 0 2px 8px rgba(111, 78, 55, 0.15);
}
#calm-candle .wick {
    position: absolute;
    left: 11px;
    bottom: 34px;
    width: 2px;
    height: 6px;
    background: #2b2b2b;
    border-radius: 1px;
}
#calm-candle .flame {
    position: absolute;
    left: 8px;
    bottom: 40px;
    width: 8px;
    height: 12px;
    background: radial-gradient(50% 60% at 50% 40%, #ffd89b 0%, #ffb25c 55%, rgba(255, 178, 92, 0) 70%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    transform-origin: 50% 90%;
    filter: drop-shadow(0 0 6px rgba(255, 183, 77, 0.8)) drop-shadow(0 0 12px rgba(227, 106, 46, 0.45));
    animation: flame-flicker 2.6s ease-in-out infinite;
}
#calm-candle .flame::after {
    content: '';
    position: absolute;
    inset: -2px;
    background: radial-gradient(60% 70% at 50% 40%, rgba(255, 240, 200, 0.5), rgba(255, 138, 76, 0) 70%);
    border-radius: inherit;
    filter: blur(1px);
}

@keyframes flame-flicker {
    0% {
        transform: translateX(0) scale(1) rotate(-1deg);
        opacity: 0.95;
    }
    15% {
        transform: translateX(-0.5px) scale(0.98, 1.02) rotate(1deg);
        opacity: 0.9;
    }
    30% {
        transform: translateX(0.4px) scale(1.02, 0.98) rotate(-0.5deg);
        opacity: 0.96;
    }
    45% {
        transform: translateX(-0.3px) scale(1.01) rotate(1deg);
        opacity: 0.92;
    }
    60% {
        transform: translateX(0.2px) scale(0.99, 1.01) rotate(-0.5deg);
        opacity: 0.95;
    }
    75% {
        transform: translateX(-0.4px) scale(1.01) rotate(0.5deg);
        opacity: 0.9;
    }
    100% {
        transform: translateX(0) scale(1) rotate(-1deg);
        opacity: 0.95;
    }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    #calm-candle .flame {
        animation: none;
    }
}
